Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\SandboxConfig;
use App\Helpers\JobConfig\Tasks\Task;

/**
* Box that compile Bison format into C/C++ sources.
Expand Down Expand Up @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array
$inputFile = $this->getInputPortValue(self::$SOURCE_FILE_PORT_KEY)->getValue(ConfigParams::$EVAL_DIR);
$inputBaseName = basename($inputFile, self::$BISON_EXT);

// Prepare cmdline args
// Prepare commandline args
$args = [];
if ($this->hasInputPortValue(self::$ARGS_PORT_KEY)) {
$args = $this->getInputPortValue(self::$ARGS_PORT_KEY)->getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@

use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\SandboxConfig;
use App\Helpers\JobConfig\Tasks\Task;

/**
* Box which represents custom compilation unit.
Expand Down Expand Up @@ -49,7 +42,7 @@ public static function init()
}

/**
* JudgeNormalBox constructor.
* CustomCompilationBox constructor.
* @param BoxMeta $meta
*/
public function __construct(BoxMeta $meta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
Expand Down
3 changes: 0 additions & 3 deletions app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FileInBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
use App\Exceptions\ExerciseCompilationException;
use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskCommands;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\Variable;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\Tasks\Task;

Expand Down
3 changes: 0 additions & 3 deletions app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesInBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
use App\Exceptions\ExerciseCompilationException;
use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskCommands;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\Variable;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\Tasks\Task;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use Exception;

/**
* Takes array of files and produces array of strings with file names (including the path).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\SandboxConfig;
use App\Helpers\JobConfig\Tasks\Task;

/**
* Box which represents fpc compilation unit.
Expand Down Expand Up @@ -116,7 +111,7 @@ public function compile(CompilationParams $params): array

$task->setCommandBinary(
$this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$FPC_BINARY_DEFAULT
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$FPC_BINARY_DEFAULT
);

$args = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\SandboxConfig;
use App\Helpers\JobConfig\Tasks\Task;

/**
* Box which represents gcc compilation unit.
Expand Down Expand Up @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array

$task->setCommandBinary(
$this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GCC_BINARY_DEFAULT
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GCC_BINARY_DEFAULT
);

$args = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
use App\Helpers\JobConfig\SandboxConfig;
use App\Helpers\JobConfig\Tasks\Task;

/**
* Box which represents g++ compilation unit.
Expand Down Expand Up @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array

$task->setCommandBinary(
$this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GPP_BINARY_DEFAULT
? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GPP_BINARY_DEFAULT
);

$args = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use App\Exceptions\FrontendErrorMappings;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use App\Helpers\JobConfig\Tasks\Task;

/**
* Customizable box for joing two pipelines in-between. There are only one input
* Customizable box for joining two pipelines in-between. There are only one input
* port and only one output port, ports can be modified.
* Default values for ports and name are not implemented.
* @note Should be used only for internal purposes.
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JudgeBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private function getJudgeBinaryAndArgs(): array
// Translation of judge type to command and args. The first item is the default.
static $judgeTypes = null;
if ($judgeTypes === null) {
// TODO - this is work in progress, a more elaborate way to define recodex-token-judge parameters will be devised soon
// TODO - this is work in progress, we need a better way to define recodex-token-judge parameters
// TODO - shuffle-rows and shuffle-all versions are not implemented yet in recodex-token-judge
// Note: recodex-token-judge is the new judge, which provides more verbose output for the logs
$commonArgs = ['--log-limit', '4k', '--ignore-trailing-whitespace'];
Expand Down Expand Up @@ -230,7 +230,7 @@ public function compile(CompilationParams $params): array
)
);

$sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE);
$sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT);
$sandbox->setOutput(true);
$task->setSandboxConfig($sandbox);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace App\Helpers\ExerciseConfig\Pipeline\Box;

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace App\Helpers\ExerciseConfig\Pipeline\Box;

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
* Box which represents execution where the main scripting file (entry-point)
* needs to be passed to a particular scripting runtime. Optinally, the runtime
* needs to be passed to a particular scripting runtime. Optionally, the runtime
* may get arguments of its own.
*/
class ScriptExecutionBox extends ExecutionBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Compilation\CompilationParams;
use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams;
use App\Helpers\ExerciseConfig\Pipeline\Ports\Port;
use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta;
use App\Helpers\ExerciseConfig\VariableTypes;

/**
* Box which represents execution where the executable file needs to
* be passed to a particular runtime. Optinally, the runtime may get
* be passed to a particular runtime. Optionally, the runtime may get
* arguments of its own.
*/
class WrappedExecutionBox extends ExecutionBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class CompilationBox extends Box
public static $RUNNER_FILE_PORT_KEY = "runner";
public static $COMPILER_EXEC_PATH_PORT_KEY = "compiler-exec-path";
public static $EXISTS_FAILED_MSG =
"Compilation process completed correctly but no executable file was yielded. Unable to proceed with testing.";
"Compilation process completed correctly but no executable file was yielded. Unable to proceed with testing.";


/**
Expand Down Expand Up @@ -57,15 +57,15 @@ protected function compileBaseTask(CompilationParams $params): Task
$task->setPriority(Priorities::$INITIATION);
$task->setType(TaskType::$INITIATION);

$sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE)->setOutput(true);
$sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT)->setOutput(true);
$task->setSandboxConfig($sandbox);

if ($params->isDebug()) {
// My debug, you bow to no one...
$sandbox->setStderrToStdout(true);
$stdoutRandom = "compilation." . Random::generate(20) . ".out";
// all outputs are stored as carboncopies in results directory
$sandbox->setCarboncopyStdout(ConfigParams::$RESULT_DIR . $stdoutRandom);
// all outputs are stored as carbon copies in results directory
$sandbox->setCarbonCopyStdout(ConfigParams::$RESULT_DIR . $stdoutRandom);
}

return $task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function compileBaseTask(CompilationParams $params): Task
$task->setPriority(Priorities::$EXECUTION);
$task->setType(TaskType::$EXECUTION);

$sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE);
$sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT);
if ($this->hasInputPortValue(self::$STDIN_FILE_PORT_KEY)) {
$sandbox->setStdin($this->getInputPortValue(self::$STDIN_FILE_PORT_KEY)->getValue(ConfigParams::$EVAL_DIR));
}
Expand All @@ -81,7 +81,7 @@ protected function compileBaseTask(CompilationParams $params): Task
if ($params->isDebug()) {
// Certainty of debug. Small chance of success. What are we waiting for?
$stderrRandom = "execution." . Random::generate(20) . ".stderr";
// all stderrs are stored alongside solution in case of debugging submission
// the stderr is stored alongside solution in case of debugging submission
$sandbox->setStderr(ConfigParams::$EVAL_DIR . $stderrRandom);
}

Expand All @@ -93,7 +93,7 @@ protected function compileBaseTask(CompilationParams $params): Task
$code = trim($code);
if (preg_match('/^(?<from>[0-9]+)\s*-+\s*(?<to>[0-9]+)$/', $code, $matches)) {
// convert string range representation ('from-to') into tuple of ints [from, to]
$code = [ (int)$matches['from'], (int)$matches['to'] ];
$code = [(int)$matches['from'], (int)$matches['to']];
}
}
$task->setSuccessExitCodes($codes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
*/
class LinuxSandbox
{
public static $ISOLATE = "isolate";
public const DEFAULT = ""; // use the sandbox specified in the worker configuration

// these are currently not used as we rely on worker configuration, but that may change in the future
public const ISOLATE = "isolate";
public const GUARDIAN = "recodex-guardian";
}
12 changes: 6 additions & 6 deletions app/helpers/JobConfig/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ public function loadSandboxConfig($data, $taskId = ""): SandboxConfig
unset($data[SandboxConfig::OUTPUT_KEY]);
}

if (isset($data[SandboxConfig::CARBONCOPY_STDOUT_KEY])) {
$sandboxConfig->setCarboncopyStdout($data[SandboxConfig::CARBONCOPY_STDOUT_KEY]);
unset($data[SandboxConfig::CARBONCOPY_STDOUT_KEY]);
if (isset($data[SandboxConfig::CARBON_COPY_STDOUT_KEY])) {
$sandboxConfig->setCarbonCopyStdout($data[SandboxConfig::CARBON_COPY_STDOUT_KEY]);
unset($data[SandboxConfig::CARBON_COPY_STDOUT_KEY]);
}

if (isset($data[SandboxConfig::CARBONCOPY_STDERR_KEY])) {
$sandboxConfig->setCarboncopyStderr($data[SandboxConfig::CARBONCOPY_STDERR_KEY]);
unset($data[SandboxConfig::CARBONCOPY_STDERR_KEY]);
if (isset($data[SandboxConfig::CARBON_COPY_STDERR_KEY])) {
$sandboxConfig->setCarbonCopyStderr($data[SandboxConfig::CARBON_COPY_STDERR_KEY]);
unset($data[SandboxConfig::CARBON_COPY_STDERR_KEY]);
}

if (isset($data[SandboxConfig::CHDIR_KEY])) {
Expand Down
Loading
Loading