CodeGrade / orca

Grading job server for CS student submissions.
1 stars 1 forks source link

Add working-directory handling to grading scripts #83

Open blerner opened 2 months ago

blerner commented 2 months ago

This needs two things:

  1. A working_dir attribute on bash and conditional commands
  2. A new cd command
    {
    cd: string,
    cmds: command[]
    }

    that changes directory to the given dir and then runs the sub-commands array while in that directory. You can probably preprocess these commands away and turn them regular commands with a working-dir attribute on them

blerner commented 2 months ago

Also need to add environment variables (using the env=dictionary... argument to subprocess.run)

blerner commented 2 months ago

Do we support working_dir already? Seems like we do? https://github.com/CodeGrade/orca/blob/293017df8bcd26fd70f48125bb19f47d96686f87/worker/orca_grader/container/build_script/preprocess/preprocessor.py#L74 and https://github.com/CodeGrade/orca/blob/293017df8bcd26fd70f48125bb19f47d96686f87/docs/orca_data_definitions.md?plain=1#L111 seem to indicate it. But https://github.com/CodeGrade/orca/blob/main/worker/orca_grader/validations/schemas/bash_grading_script_command_schema.json doesn't include it as an attribute...

blerner commented 2 months ago

If working dirs are already supported, I can probably finesse environment variables by prefixing the commands with env VAR=val ...actual command... when needed. So if working dirs exist, then rename this issue to reframe the discussion, and it'll drop to a lower priority.