Skip to content

Commit

Permalink
[base-containers] add support for common run file (#805)
Browse files Browse the repository at this point in the history
To keep retrocompatibility, first look in mounted ``/task``, then in RO-mounted ``/course/common``, then in ``/course``
  • Loading branch information
anaHue committed Mar 14, 2022
1 parent 98b8e33 commit 31c337c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base-containers/base/bin/INGInious
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class INGIniousMainRunner:

if run_cmd is not None:
return run_cmd.split(" ")
for prefix in ["task", "course"]:
for prefix in ["task", "course/common", "course"]:
if os.path.exists("/{}/run".format(prefix)):
return ["/{}/run".format(prefix)]
for ext, cmd in run_types.items():
Expand Down
8 changes: 6 additions & 2 deletions base-containers/base/inginious_container_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ def set_limits_user(user):


def set_executable(filename):
st = os.stat(filename)
os.chmod(filename, st.st_mode | stat.S_IEXEC)
# When mounting the course/common/run file, the permissions of the file on the host and in the container will still be the same
# It should therefore already be executable on the host for the moment
# TODO: fix this problem by moving the set_executable function to the agent where temporary folder is created for example
if not filename.startswith("/course/common"):
st = os.stat(filename)
os.chmod(filename, st.st_mode | stat.S_IEXEC)


def execute_process(args, stdin_string="", internal_command=False, user="worker"):
Expand Down

0 comments on commit 31c337c

Please sign in to comment.