Skip to content

Commit

Permalink
Cleanup the judgehost file
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vasseur committed Oct 17, 2024
1 parent 1edc428 commit 9362b92
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,10 @@ function fetch_executable_internal(
// Request open submissions to judge. Any errors will be treated as
// non-fatal: we will just keep on retrying in this loop.
$judging = request('judgehosts/fetch-work', 'POST', ['hostname' => $myhost], false);
var_dump($judging);
// If $judging is null, an error occurred; don't try to decode.
if (!is_null($judging)) {
$row = dj_json_decode($judging);
}
var_dump("Working judging.");

// nothing returned -> no open submissions for us
if (empty($row)) {
Expand All @@ -778,7 +776,6 @@ function fetch_executable_internal(
}
continue;
}
var_dump("Non empty.");

// We have gotten a work packet.
$endpoints[$endpointID]["waiting"] = false;
Expand All @@ -787,9 +784,7 @@ function fetch_executable_internal(
logmsg(LOG_INFO,
"⇝ Received " . sizeof($row) . " '" . $type . "' judge tasks (endpoint $endpointID)");

var_dump($row);
$jobId = $row[0]['jobid'];
var_dump($jobId);

if ($type == 'prefetch') {
if ($lastWorkdir !== null) {
Expand Down Expand Up @@ -820,11 +815,9 @@ function fetch_executable_internal(
logmsg(LOG_INFO, " 🔥 Pre-heating judgehost completed.");
continue;
}
var_dump("Get here...");

// Create workdir for judging.
$workdir = judging_directory($workdirpath, $row[0]);
var_dump($workdir);
logmsg(LOG_INFO, " Working directory: $workdir");

if ($type == 'debug_info') {
Expand Down Expand Up @@ -879,8 +872,6 @@ function fetch_executable_internal(
continue;
}

var_dump($row);
var_dump("Working on output_visual");
if ($type == 'output_visualization') {
if ($lastWorkdir !== null) {
cleanup_judging($lastWorkdir);
Expand All @@ -903,14 +894,10 @@ function fetch_executable_internal(
}

$teamoutput = $workdir . "/testcase" . sprintf('%05d', $judgeTask['testcase_id']) . '/1/program.out';
//$feedbackoutput = $wVorkdir . "/testcase" . sprintf('%05d', $judgeTask['testcase_id']) . '/1/feedback/visual.png';
var_dump("Working in", $teamoutput);
$visual_cmd = implode(' ', array_map('dj_escapeshellarg',
[$runpath, $teamoutput, $tmpfile]));
var_dump($visual_cmd);
system($visual_cmd, $retval);
// FIXME: check retval
var_dump("testcase", $judgeTask['testcase_id']);

request(
sprintf('judgehosts/add-visual/%s/%s', urlencode($myhost),
Expand All @@ -920,8 +907,6 @@ function fetch_executable_internal(
'testcase_id' => $judgeTask['testcase_id']],
false
);
$b = rest_encode_file($tmpfile, false);
var_dump($b);
unlink($tmpfile);

logmsg(LOG_INFO, " ⇡ Uploading visual output of workdir $workdir.");
Expand Down

0 comments on commit 9362b92

Please sign in to comment.