diff --git a/course/page/code.py b/course/page/code.py index a19c47f7c948e2d32745cf138492b7612611068c..b37bbd0e6c3367906e48a77bcf1a3930cbd561ca 100644 --- a/course/page/code.py +++ b/course/page/code.py @@ -98,7 +98,7 @@ class PythonCodeForm(StyledForm): pass -CFRUNPY_PORT = 9941 +RUNPY_PORT = 9941 class InvalidPingResponse(RuntimeError): @@ -132,15 +132,15 @@ def request_python_run(run_req, run_timeout, image=None): version='1.12', timeout=docker_timeout) if image is None: - image = settings.CF_DOCKER_CFRUNPY_IMAGE + image = settings.RELATE_DOCKER_RUNPY_IMAGE dresult = docker_cnx.create_container( image=image, command=[ - "/opt/cfrunpy/cfrunpy", + "/opt/runpy/runpy", "-1"], mem_limit=256e6, - user="cfrunpy") + user="runpy") container_id = dresult["Id"] else: @@ -152,12 +152,12 @@ def request_python_run(run_req, run_timeout, image=None): if container_id is not None: docker_cnx.start( container_id, - port_bindings={CFRUNPY_PORT: ('127.0.0.1',)}) + port_bindings={RUNPY_PORT: ('127.0.0.1',)}) - port_info, = docker_cnx.port(container_id, CFRUNPY_PORT) + port_info, = docker_cnx.port(container_id, RUNPY_PORT) port = int(port_info["HostPort"]) else: - port = CFRUNPY_PORT + port = RUNPY_PORT from time import time, sleep start_time = time() @@ -627,7 +627,7 @@ class PythonCodeQuestion(PageBaseWithTitle, PageBaseWithValue): correctness = 0 else: - raise RuntimeError("invalid cfrunpy result: %s" % response.result) + raise RuntimeError("invalid runpy result: %s" % response.result) if hasattr(response, "feedback") and response.feedback: feedback_bits.append( diff --git a/cfrunpy/Dockerfile b/docker-image-runpy/Dockerfile similarity index 78% rename from cfrunpy/Dockerfile rename to docker-image-runpy/Dockerfile index 69713607468a8efd6ba42eda8a45e23c4addeaa8..e9fc205d61d64774d4359770b5f09c455dc0ed4a 100644 --- a/cfrunpy/Dockerfile +++ b/docker-image-runpy/Dockerfile @@ -1,11 +1,11 @@ FROM inducer/debian-i386 MAINTAINER Andreas Kloeckner <inform@tiker.net> EXPOSE 9941 -RUN useradd cfrunpy +RUN useradd runpy -RUN mkdir -p /opt/cfrunpy -ADD cfrunpy /opt/cfrunpy/ -ADD cfrunpy_backend.py /opt/cfrunpy/ +RUN mkdir -p /opt/runpy +ADD runpy /opt/runpy/ +ADD runpy_backend.py /opt/runpy/ RUN apt-get update RUN apt-get -y -o APT::Install-Recommends=0 -o APT::Install-Suggests=0 install python3-scipy python3-pip python3-matplotlib python3-pillow diff --git a/cfrunpy/cfrunpy b/docker-image-runpy/runpy similarity index 97% rename from cfrunpy/cfrunpy rename to docker-image-runpy/runpy index c95292363d9858cdcb48c2320d621d2f7425afc8..4a2750e17a57fc95f4fdfbc8167860774ffd0d71 100755 --- a/cfrunpy/cfrunpy +++ b/docker-image-runpy/runpy @@ -29,7 +29,7 @@ import socketserver import json import sys import io -from cfrunpy_backend import Struct, run_code, package_exception +from runpy_backend import Struct, run_code, package_exception from http.server import BaseHTTPRequestHandler PORT = 9941 @@ -74,7 +74,7 @@ class RunRequestHandler(BaseHTTPRequestHandler): clength = int(self.headers['content-length']) recv_data = self.rfile.read(clength) - print("CFRUNPY RECEIVED %d bytes" % len(recv_data), + print("RUNPY RECEIVED %d bytes" % len(recv_data), file=prev_stderr) run_req = Struct(json.loads(recv_data.decode("utf-8"))) print("REQUEST: %r" % run_req, file=prev_stderr) diff --git a/cfrunpy/cfrunpy_backend.py b/docker-image-runpy/runpy_backend.py similarity index 100% rename from cfrunpy/cfrunpy_backend.py rename to docker-image-runpy/runpy_backend.py diff --git a/exercise-docker.py b/exercise-docker.py index 48dc6731c23dedb51d263bff669dcb19b9b53291..09821f7b66a3679ddb2d943d1bae40b6e46758e0 100644 --- a/exercise-docker.py +++ b/exercise-docker.py @@ -14,7 +14,7 @@ def main(): print count count += 1 res = request_python_run(req, 5, - image="inducer/cfrunpy-i386") + image="inducer/runpy-i386") if res["result"] != "success": print res break diff --git a/local_settings.py.example b/local_settings.py.example index 643048c616818fa37c042e899763706626f00889..00cccfaf281660da9983aefd306535c39421457b 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -67,6 +67,6 @@ STUDENT_SIGN_IN_VIEW = "course.auth.sign_in_by_email" # A string containing the image ID of the docker image to be used to run # student code. Docker should download the image on first run. -CF_DOCKER_CFRUNPY_IMAGE = "inducer/cfrunpy-i386" +RELATE_DOCKER_RUNPY_IMAGE = "inducer/relate-runpy-i386" -CF_MAINTENANCE_MODE = False +RELATE_MAINTENANCE_MODE = False diff --git a/relate/urls.py b/relate/urls.py index 0a9bdd6c7f99e1efc309951c43eff1a6d80465a0..4fb85b2265fd95ac69a3588508a5ea4d8640fcce 100644 --- a/relate/urls.py +++ b/relate/urls.py @@ -299,7 +299,7 @@ urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), ) -if settings.CF_MAINTENANCE_MODE: +if settings.RELATE_MAINTENANCE_MODE: urlpatterns = patterns('', # course url(r'^.*$', 'course.views.maintenance'), diff --git a/relate/utils.py b/relate/utils.py index 9e59d718bfaea8b8ec4496c8c551f789e5228aaf..99992af9ae756da637b5ad3ffc175c2611dfb660 100644 --- a/relate/utils.py +++ b/relate/utils.py @@ -54,7 +54,7 @@ def settings_context_processor(request): from django.conf import settings return { "student_sign_in_view": settings.STUDENT_SIGN_IN_VIEW, - "maintenance_mode": settings.CF_MAINTENANCE_MODE, + "maintenance_mode": settings.RELATE_MAINTENANCE_MODE, } diff --git a/setup.py b/setup.py index a2c8723d58325e588cfb10e0289af62bbc224330..c979e17105b713d561be7b2bbc72091c9c3fd8f6 100644 --- a/setup.py +++ b/setup.py @@ -4,14 +4,14 @@ from setuptools import setup # This script really only installs the validation script, -# cf-validate. Its use is not needed (and indeed not recommended) +# relate-validate. Its use is not needed (and indeed not recommended) # for deploying RELATE as a web service. setup(name="relate-validation", version="2014.1", description="Installer for the RELATE validation script", - scripts=["bin/cf-validate"], + scripts=["bin/relate-validate"], author="Andreas Kloeckner", url="https://github.com/inducer/relate", author_email="inform@tiker.net",