Skip to content

Commit

Permalink
Update to latest version of Docker; update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Derval committed Mar 4, 2016
1 parent 4f57076 commit 94d0281
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
12 changes: 6 additions & 6 deletions doc/install_doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ If you already have ``web.py`` on your machine, run:
$ pip uninstall web.py
$ pip install web.py-INGI

Centos 7.0+
```````````
Centos 7.0+, Fedora 22+
```````````````````````

::

$ sudo yum install -y epel-release
$ sudo yum install -y epel-release #CentOS only
$ sudo yum install -y git mongodb mongodb-server docker python-pip gcc python-devel libtidy

.. note::
Expand Down Expand Up @@ -139,7 +139,7 @@ recent project, it is better to use dev version, which have a lot more functionn

::

$ pip install --process-dependency-links --upgrade git+https://github.com/UCL-INGI/INGInious.git
$ pip install --upgrade git+https://github.com/UCL-INGI/INGInious.git

Run the same command to upgrade.

Expand All @@ -150,7 +150,7 @@ Run the same command to upgrade.

::

$ pip install --process-dependency-links --upgrade git+https://github.com/UCL-INGI/INGInious.git[cgi,ldap]
$ pip install --upgrade git+https://github.com/UCL-INGI/INGInious.git[cgi,ldap]


Pip+Pipy
Expand All @@ -161,7 +161,7 @@ version from pipy than with the development version.

::

$ pip install --process-dependency-links --upgrade inginious
$ pip install --upgrade inginious

Run the same command to upgrade.

Expand Down
38 changes: 22 additions & 16 deletions inginious/backend/agent/simple_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,16 @@ def handle_job(self, job_id, course_id, task_id, inputdata, debug, ssh_callback)
environment,
stdin_open=True,
volumes={'/task': {}, '/sockets': {}},
network_disabled=not (task.allow_network_access_grading() or debug == "ssh")
network_disabled=not (task.allow_network_access_grading() or debug == "ssh"),
host_config = docker_connection.create_host_config(
mem_limit=str(mem_limit) + "M",
memswap_limit=str(mem_limit) + "M",
mem_swappiness=0,
oom_kill_disable=True,
network_mode=("bridge" if (task.allow_network_access_grading() or debug == "ssh") else 'none'),
binds={os.path.abspath(task_path): {'ro': False, 'bind': '/task'},
os.path.abspath(sockets_path): {'ro': False, 'bind': '/sockets'}}
)
)
container_id = response["Id"]
self._container_for_job[job_id] = container_id
Expand Down Expand Up @@ -385,13 +394,7 @@ def handle_job(self, job_id, course_id, task_id, inputdata, debug, ssh_callback)
student_container_management_thread.start()

# Start the container
docker_connection.start(container_id,
binds={os.path.abspath(task_path): {'ro': False, 'bind': '/task'},
os.path.abspath(sockets_path): {'ro': False, 'bind': '/sockets'}},
mem_limit=mem_limit * 1024 * 1024,
memswap_limit=mem_limit * 1024 * 1024, # disable swap
oom_kill_disable=True,
network_mode=("bridge" if (task.allow_network_access_grading() or debug == "ssh") else None))
docker_connection.start(container_id)

# Send the input data
container_input = {"input": inputdata, "limits": limits}
Expand Down Expand Up @@ -505,18 +508,21 @@ def _create_new_student_container(self, container_name, working_dir, command, me
volumes={'/task/student': {}},
command=command,
working_dir=working_dir,
user="4242"
user="4242",
mem_limit=str(mem_limit)+"M",
host_config=docker_connection.create_host_config(
mem_limit=str(mem_limit) + "M",
memswap_limit= str(mem_limit) + "M",
mem_swappiness=0,
oom_kill_disable=True,
network_mode=('none' if not share_network else ('container:' + parent_container_id)),
binds={os.path.abspath(student_path): {'ro': False, 'bind': '/task/student'}}
)
)
container_id = response["Id"]

# Start the container
docker_connection.start(container_id,
binds={os.path.abspath(student_path): {'ro': False, 'bind': '/task/student'}},
mem_limit=mem_limit * 1024 * 1024, # add 10 mo of bonus, as we check the memory in the "cgroup" thread
memswap_limit=mem_limit * 1024 * 1024, # disable swap
oom_kill_disable=True,
network_mode=(None if not share_network else ('container:'+parent_container_id))
)
docker_connection.start(container_id)

stdout_err = docker_connection.attach_socket(container_id, {'stdin': 0, 'stdout': 1, 'stderr': 1, 'stream': 1, 'logs': 1})
except Exception as e:
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

install_requires = [
"docker-py==1.3.0.dev0",
"docker-py==1.7.2",
"docutils>=0.12",
"plumbum>=1.5.0",
"pymongo>=3.0.3",
Expand Down Expand Up @@ -54,7 +54,6 @@
version=inginious.__version__,
description="An intelligent grader that allows secured and automated testing of code made by students.",
packages=find_packages(),
dependency_links=["git+https://github.com/GuillaumeDerval/docker-py.git#egg=docker-py-1.3.0.dev0"],
install_requires=install_requires,
tests_require=test_requires,
extras_require={
Expand Down

0 comments on commit 94d0281

Please sign in to comment.