Skip to content

Commit

Permalink
V2.2.6 fixs (#78)
Browse files Browse the repository at this point in the history
* fixes

* ADD blog 1

* FIX markdown to jsx translation

* FIX optomize dockerfiles and fix animations
  • Loading branch information
wabscale authored Mar 17, 2021
1 parent 403e322 commit 01295a4
Show file tree
Hide file tree
Showing 22 changed files with 482 additions and 182 deletions.
17 changes: 15 additions & 2 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@ WORKDIR /opt/app

COPY requirements.txt requirements.txt

RUN apk add --update --no-cache mariadb-client git curl tzdata gcc musl-dev libmagic \
RUN apk add --update --no-cache mariadb-client git tzdata gcc g++ musl-dev libmagic \
&& pip3 install --no-cache-dir -r ./requirements.txt \
&& adduser -D anubis \
&& chown anubis:anubis -R /opt/app \
&& ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
&& ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \
&& apk del gcc g++ \
&& env USER=root find /opt/app -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
\) -exec rm -rf '{}' + \
\
&& env USER=root find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
\) -exec rm -rf '{}' +


USER anubis

Expand Down
10 changes: 6 additions & 4 deletions api/anubis/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def init_services(app):
:param app: Flask app
:return:
"""
from anubis.models import db
from anubis.utils.cache import cache
from anubis.config import config
from anubis.models import db, Config
from anubis.utils.cache import cache, cache_health
from anubis.utils.migrate import migrate
from anubis.utils.elastic import add_global_error_handler
from anubis.config import config

# Init services
db.init_app(app)
Expand All @@ -22,7 +22,9 @@ def init_services(app):

@app.route("/")
def index():
return "Hello there..."
Config.query.all()
cache_health()
return "Healthy"

# Add ELK stuff
if not config.DISABLE_ELK:
Expand Down
1 change: 1 addition & 0 deletions api/anubis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def data(self):
"state": self.state,
"created": str(self.created),
"last_updated": str(self.last_updated),
"error": self.errors is not None,
}

@property
Expand Down
2 changes: 1 addition & 1 deletion api/anubis/rpc/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from anubis.models import Config, Submission
from anubis.utils.logger import logger

from anubis.utils.data import is_debug

def create_pipeline_job_obj(client, submission):
"""
Expand Down
5 changes: 5 additions & 0 deletions api/anubis/utils/cache.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from flask_caching import Cache

cache = Cache(config={"CACHE_TYPE": "redis"})


@cache.cached(timeout=1)
def cache_health():
pass
255 changes: 127 additions & 128 deletions docs/design.md

Large diffs are not rendered by default.

Binary file added docs/img/theia-fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions docs/posts/1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Anubis Autograder

![](../img/anubis-icon-1.png)

## Elevator Pitch

At its core, Anubis is a tool to give students live feedback from their homework
assignments
while they are working on them. Using [Github Classrooms](https://classroom.github.com/),
each student gets their
own repo from a template
for each homework assignment. The way students then submit their work
is simply by pushing their work to their repo before the deadline. Students can
then push, and therefore submit as many times as
they would like before the deadline.

## Assignment structure

When a student pushes to their assignment repo, a job is launched on the Anubis
cluster. That job will build
their repo, run tests on the results, and store the results in a database.

Students can then navigate to the Anubis website, where
they will sign in through NYU SSO.
From there,
they will be able to see all the current and past assignments,
and all of their submissions. They are able
to view the results of the build and tests for each submission.
There they can request a regrade,
there by launching a new submission pipeline. While the submission
still being processed, the website will poll
the backend for updates. In this, the website will be constantly
updating while the submission is being
processed, giving a live and interactive feel to the site. Once
a submission is processed Anubis will show
the students logs from their tests, and builds along with which
tests passed and which failed.

![alt autogade-results](../img/autograde-results.png)

## Anubis Cloud IDEs

New in version v2.2.0, there is now the Anubis Cloud IDE. Using some
kubernetes magic, we are able to
host [theia](https://theia-ide.org/) servers for individual students.
These are essentially
VSCode instances
that students can access in the browser. What makes these so powerful
is that students can access a terminal
and type commands right into a bash shell which will be run in the
remote container. With this setup students
have access to a fully insulated and prebuilt linux
environment at a click of a button. These environments are easily customizable
for the needs of the class or even individual assignments. Because these
IDE servers are light weight docker containers we can support
many more students than if we used VMs. There are ~130 students in the Intro
to OS course in spring of 2021, and we could support all of them
using IDEs at the same time while still processing all the submissions that
come through.

As we are giving students access to a terminal in the cloud, we must also lock
down their environment. All student IDEs are limited in the RAM, CPU, storage,
and networking. From the IDEs, students are only able to connect to Github to
submit their work.

![alt anubis-ide](../img/theia-fullscreen.png)



> Does any of this sound appealing to you? Reach out to us to see if Anubis is
something that can benefit your class!
11 changes: 5 additions & 6 deletions kube/templates/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ spec:
value: {{ .Values.theia.proxy.domain | quote }}
{{- if .Values.api.healthCheck }}
livenessProbe:
exec:
command:
- curl
- http://localhost:5000/
initialDelaySeconds: 10
periodSeconds: 5
httpGet:
path: /
port: 5000
initialDelaySeconds: 15
periodSeconds: 3
{{- end }}

# Mail container
Expand Down
9 changes: 5 additions & 4 deletions theia/sidecar/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ logfile=/supervisord.log
[program:autosave-loop]
directory=/
command=/autosave-loop.sh
environment=HOME="/home/theia"
autorestart=true
user=theia
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
stdout_logfile=/home/theia/autosave.log

[program:autosave-server]
directory=/
command=gunicorn -b 0.0.0.0:5001 -w 1 app:app
autorestart=true
environment=HOME="/home/theia"
user=theia
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
stdout_logfile=/home/theia/server.log
16 changes: 8 additions & 8 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM node:alpine

WORKDIR /opt/app
COPY package.json .
COPY yarn.lock .

# install dependencies
# add program for serving static
# build prod
# delete fluff
RUN apk add --update --no-cache curl && yarn \
&& yarn global add serve
RUN yarn
COPY . .
RUN yarn run build \
&& rm -rf node_modules src public package.json yarn.lock


FROM node:alpine
WORKDIR /opt/app
RUN apk add --update --no-cache curl && yarn global add serve
COPY --from=0 /opt/app/build /opt/app/build


CMD serve -s build -l 3000
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"axios": "^0.21.1",
"clsx": "^1.1.0",
"date-fns": "^2.0.0",
"markdown-to-jsx": "^7.1.2",
"notistack": "^1.0.3",
"react": "^17.0.1",
"react-ace": "^9.2.0",
Expand Down
Binary file added web/public/anubis-icon-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/autograde-results-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/theia-fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions web/src/Components/Public/IDE/IDEDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ export default function IDEDialog({selectedTheia, setSelectedTheia}) {
setSession(data.session);
}
if (data?.session?.autosave !== undefined) {
console.log('autosave', data.session.autosave);
setAutosaveEnabled(data.autosaveEnabled);
setAutosaveEnabled(data.session.autosave);
}
}).catch(standardErrorHandler(enqueueSnackbar));
}, [selectedTheia]);
Expand Down
38 changes: 29 additions & 9 deletions web/src/Components/Public/Submission/SubmissionSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import TableCell from '@material-ui/core/TableCell';
import Divider from '@material-ui/core/Divider';
import {useSnackbar} from 'notistack';
import clsx from 'clsx';
import Fab from '@material-ui/core/Fab';

const useStyles = makeStyles((theme) => ({
root: {
Expand All @@ -40,7 +41,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

export default function SubmissionSummary({submission, regrade, stop = false}) {
export default function SubmissionSummary({submission, regrade, stop}) {
const classes = useStyles();
const {enqueueSnackbar} = useSnackbar();

Expand All @@ -64,6 +65,28 @@ export default function SubmissionSummary({submission, regrade, stop = false}) {
const testsPassed = submission.tests.filter((test) => test.result.passed).length;
const totalTests = submission.tests.length;

const ReloadIcon = () => (
<Tooltip title={'regrade'}>
<Fab
onClick={() => regrade(submission.commitHash, enqueueSnackbar)}
size={'small'}
color={'primary'}
>
<RefreshIcon/>
</Fab>
</Tooltip>
);

const LoadingIcon = () => (
<Tooltip title={submission.state}>
<IconButton
onClick={() => regrade(submission.commitHash, enqueueSnackbar)}
>
<CircularProgress size="1em"/>
</IconButton>
</Tooltip>
);

return (
<Card className={classes.root}>
<CardActionArea>
Expand Down Expand Up @@ -134,14 +157,11 @@ export default function SubmissionSummary({submission, regrade, stop = false}) {
{/* Submission state */}
<ListItem>
<ListItemIcon>
<Tooltip title={!submission.processed ? submission.state : 'regrade'}>
<IconButton component="div" onClick={() =>
regrade(submission.commitHash, enqueueSnackbar)}>
{(submission.processed && !stop) ?
<RefreshIcon color={'primary'}/> :
<CircularProgress size="1em"/>}
</IconButton>
</Tooltip>
{stop ? <ReloadIcon/> : (
submission.processed ?
<ReloadIcon/> :
<LoadingIcon/>
)}
</ListItemIcon>
<ListItemText primary={submission.state}/>
</ListItem>
Expand Down
24 changes: 16 additions & 8 deletions web/src/Components/Public/Submission/SubmissionTests.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,25 @@ export default function SubmissionTests({tests, stop}) {
<div className={classes.wrapper}>
<Fab
aria-label="save"
color={test.result.passed === false ? 'secondary' : 'primary'}
color={stop ? 'secondary' : (test.result.passed === false ? 'secondary' : 'primary')}
>
{test.result.passed === null ? (
<AssessmentIcon/>
) : (test.result.passed === true && !stop) ? (
<CheckCircleIcon/>
) : (test.result.passed === false || stop) ? (
{stop ? (
<CancelIcon/>
) : null}
) : (
<React.Fragment>
{test.result.passed === null ? (
<AssessmentIcon/>
) : (test.result.passed === true) ? (
<CheckCircleIcon/>
) : (test.result.passed === false) ? (
<CancelIcon/>
) : null}
</React.Fragment>
)}
</Fab>
{test.result.passed === null && <CircularProgress size={68} className={classes.fabProgress}/>}
{stop ? null : (
test.result.passed === null && <CircularProgress size={68} className={classes.fabProgress}/>
)}
</div>
<Typography className={classes.heading}>{test.test.name}</Typography>
</AccordionSummary>
Expand Down
25 changes: 18 additions & 7 deletions web/src/Navigation/navconfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import GroupIcon from '@material-ui/icons/Group';
import SettingsIcon from '@material-ui/icons/Settings';
import PieChartIcon from '@material-ui/icons/PieChart';
import AttachFileIcon from '@material-ui/icons/AttachFile';
import BookIcon from '@material-ui/icons/Book';

import About from '../Pages/Public/About';
import Courses from '../Pages/Public/Courses';
Expand All @@ -19,6 +20,7 @@ import Profile from '../Pages/Public/Profile';
import Repos from '../Pages/Public/Repos';
import Submissions from '../Pages/Public/Submissions';
import Submission from '../Pages/Public/Submission';
import Blog from '../Pages/Public/Blog';

import AdminUsers from '../Pages/Admin/Users';
import AdminUser from '../Pages/Admin/User';
Expand All @@ -31,13 +33,22 @@ import AdminTheia from '../Pages/Admin/Theia';
import AdminStatic from '../Pages/Admin/Static';
import AdminConfig from '../Pages/Admin/Config';

export const footer_nav = [{
id: 'About',
icon: <PublicIcon/>,
exact: true,
path: '/about',
Page: About,
}];
export const footer_nav = [
{
id: 'About',
icon: <PublicIcon/>,
exact: true,
path: '/about',
Page: About,
},
{
id: 'Blog',
icon: <BookIcon/>,
exact: true,
path: '/blog',
Page: Blog,
},
];

export const public_nav = [
{
Expand Down
Loading

0 comments on commit 01295a4

Please sign in to comment.