Skip to content

Commit c440751

Browse files
committed
Tweaks for compilation output
1 parent f4f4c80 commit c440751

4 files changed

Lines changed: 14 additions & 64 deletions

File tree

docs/submission-phase-scoring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Runner task logs are written to CloudWatch using the submission runner log strea
101101

102102
For `PROVISIONAL` and `SYSTEM` scoring, the runner writes progress to the phase review summation metadata through `POST /v6/marathon-match/internal/scoring-progress`. Review API exposes this as `reviewSummation.metadata.testProcess` (`provisional` or `system`), `reviewSummation.metadata.testProgress` (`0` to `1`), and `reviewSummation.metadata.testStatus` (`IN PROGRESS`, `SUCCESS`, or `FAILED`) when metadata is included in the response. In-progress summations keep a neutral placeholder score and must be rendered as unavailable based on `testStatus`; only `FAILED` progress uses the failed-score sentinel. SYSTEM timeout failures also include `reviewSummation.metadata.timed_out = true`.
103103

104-
For generic runner artifacts, only EXAMPLE scoring uploads the member-visible public artifact. Its public `output.txt` starts with the captured compilation output, then includes each testcase ordinal, actual seed, seed score, runtime, runner/tester errors, and submitted-solution stderr, while submitted-solution stdout stays private. Every generic scoring phase uploads private internal artifacts: `reviews.json` includes `compilationOutput`, per-test score details with testcase ordinals and actual seeds, and top-level `testScores`; callback metadata keeps member-visible testcase ordinals only, compile and execution logs are preserved as `compile_log.txt`, `execution-{submissionId}.log`, and optional `error-{submissionId}.log`, and captured submitted-solution output is split into `stdout/{seed}.txt` and `stderr/{seed}.txt` files for each actual seed. PROVISIONAL and SYSTEM scoring do not publish competitor-visible artifacts.
104+
For generic runner artifacts, only EXAMPLE scoring uploads the member-visible public artifact. Its public `output.txt` includes each testcase ordinal, actual seed, seed score, runtime, runner/tester errors, and submitted-solution stderr, while submitted-solution stdout and compilation diagnostics stay out of that file. The separate `compile_log.txt` file preserves compilation output. Every generic scoring phase uploads private internal artifacts: `reviews.json` includes `compilationOutput`, per-test score details with testcase ordinals and actual seeds, and top-level `testScores`; callback metadata keeps member-visible testcase ordinals only, compile and execution logs are preserved as `compile_log.txt`, `execution-{submissionId}.log`, and optional `error-{submissionId}.log`, and captured submitted-solution output is split into `stdout/{seed}.txt` and `stderr/{seed}.txt` files for each actual seed. PROVISIONAL and SYSTEM scoring do not publish competitor-visible artifacts.
105105

106106
When more than one phase config matches the currently open challenge phases, the handler launches one scorer task per match. This is the supported way to run both `EXAMPLE` and `PROVISIONAL` scoring from the same Submission phase.
107107

ecs-runner/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Once this is saved and the config is active, new scoring launches use the new EC
142142

143143
The runner rejects output once generated public `output.txt` content or a public/private artifact archive would exceed `MM_RUNNER_MAX_OUTPUT_BYTES`. The default is `10000000` bytes. The trusted parent runner passes the resolved limit into the isolated tester child, so generated generic-runner output and uploaded artifact zips use the same cap.
144144

145-
Generic runner member-visible artifacts are uploaded only for EXAMPLE scoring. Their public `output.txt` starts with the captured compilation output, then shows testcase ordinal, actual seed, seed score, runtime, runner/tester errors, and submitted-solution stderr, while intentionally omitting submitted-solution stdout. Every generic scoring phase uploads private internal artifacts in the `*-internal` zip: `reviews.json` carries `compilationOutput`, per-test `metadata.testScores`, and top-level `testScores` with testcase ordinals and actual seeds, `compile_log.txt` and `execution-{submissionId}.log` preserve runner diagnostics, `error-{submissionId}.log` is included when present, and `stdout/{seed}.txt` plus `stderr/{seed}.txt` carry captured submitted-solution output for each actual seed. PROVISIONAL and SYSTEM scoring do not publish competitor-visible artifacts.
145+
Generic runner member-visible artifacts are uploaded only for EXAMPLE scoring. Their public `output.txt` shows testcase ordinal, actual seed, seed score, runtime, runner/tester errors, and submitted-solution stderr, while intentionally omitting submitted-solution stdout and compilation diagnostics. The separate `compile_log.txt` file preserves compilation output. Every generic scoring phase uploads private internal artifacts in the `*-internal` zip: `reviews.json` carries `compilationOutput`, per-test `metadata.testScores`, and top-level `testScores` with testcase ordinals and actual seeds, `compile_log.txt` and `execution-{submissionId}.log` preserve runner diagnostics, `error-{submissionId}.log` is included when present, and `stdout/{seed}.txt` plus `stderr/{seed}.txt` carry captured submitted-solution output for each actual seed. PROVISIONAL and SYSTEM scoring do not publish competitor-visible artifacts.
146146

147147
## Local smoke test
148148

ecs-runner/src/main/java/com/topcoder/runner/EcsRunnerMain.java

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4651,12 +4651,7 @@ private static TesterExecutionResult runGenericMarathonTester(
46514651
);
46524652
String compilationOutput = readCompilationOutput(compileLogPath);
46534653
StringBuilder outputText = new StringBuilder();
4654-
long outputBytes = appendLimitedOutput(
4655-
outputText,
4656-
buildMemberVisibleCompilationOutput(compilationOutput),
4657-
0L,
4658-
"artifacts/public/output.txt"
4659-
);
4654+
long outputBytes = 0L;
46604655
grantScorerReadExecuteAccess(compileWorkDir);
46614656

46624657
MarathonController controller = new MarathonController();
@@ -4780,7 +4775,7 @@ private static TesterExecutionResult runGenericMarathonTester(
47804775
new ArrayList<Map<String, Object>>()
47814776
);
47824777
} catch (Exception error) {
4783-
writePreResultMemberOutput(outputPath, compileLogPath, error);
4778+
writePreResultMemberOutput(outputPath, error);
47844779
throw error;
47854780
} finally {
47864781
if (!cleanupDeferred) {
@@ -4790,7 +4785,7 @@ private static TesterExecutionResult runGenericMarathonTester(
47904785
}
47914786

47924787
/**
4793-
* Reads the compiler log that should be embedded in member-visible and private outputs.
4788+
* Reads the compiler log that should be retained in metadata and private outputs.
47944789
*
47954790
* @param compileLogPath Public compile log written by compiler commands.
47964791
* @return Compiler output text, or a short no-output marker when no compiler command ran.
@@ -4811,37 +4806,15 @@ private static String readCompilationOutput(Path compileLogPath) throws IOExcept
48114806
return compilationOutput;
48124807
}
48134808

4814-
/**
4815-
* Builds the public {@code output.txt} compilation section shown before test cases.
4816-
*
4817-
* @param compilationOutput Compiler diagnostics captured for the submission.
4818-
* @return Member-visible compilation text block ending with a blank line.
4819-
*/
4820-
private static String buildMemberVisibleCompilationOutput(
4821-
String compilationOutput
4822-
) {
4823-
StringBuilder outputText = new StringBuilder();
4824-
outputText.append("Compilation Output:\n");
4825-
if (compilationOutput == null || compilationOutput.trim().isEmpty()) {
4826-
outputText.append("No compilation output was produced.");
4827-
} else {
4828-
outputText.append(compilationOutput.trim());
4829-
}
4830-
outputText.append("\n\n");
4831-
return outputText.toString();
4832-
}
4833-
48344809
/**
48354810
* Writes a partial member-visible output file when the generic runner fails
48364811
* before normal score output can be finalized.
48374812
*
48384813
* @param outputPath Public {@code output.txt} artifact path.
4839-
* @param compileLogPath Public compile log path to embed.
48404814
* @param error Failure that prevented normal output generation.
48414815
*/
48424816
private static void writePreResultMemberOutput(
48434817
Path outputPath,
4844-
Path compileLogPath,
48454818
Throwable error
48464819
) {
48474820
if (outputPath == null || isNonSymlinkRegularFile(outputPath)) {
@@ -4850,16 +4823,10 @@ private static void writePreResultMemberOutput(
48504823

48514824
try {
48524825
StringBuilder outputText = new StringBuilder();
4853-
long outputBytes = appendLimitedOutput(
4854-
outputText,
4855-
buildMemberVisibleCompilationOutput(readCompilationOutput(compileLogPath)),
4856-
0L,
4857-
"artifacts/public/output.txt"
4858-
);
48594826
appendLimitedOutput(
48604827
outputText,
48614828
"Runner Error:\n" + safeLogValue(error == null ? null : error.getMessage()) + "\n",
4862-
outputBytes,
4829+
0L,
48634830
"artifacts/public/output.txt"
48644831
);
48654832

ecs-runner/src/test/java/com/topcoder/runner/EcsRunnerMainTest.java

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,7 @@ public void buildMemberVisibleTestOutputShowsSeedAndScoreButHidesStdout()
130130
}
131131

132132
@Test
133-
public void buildMemberVisibleCompilationOutputShowsCompilerDiagnostics()
134-
throws Exception {
135-
Method method = EcsRunnerMain.class.getDeclaredMethod(
136-
"buildMemberVisibleCompilationOutput",
137-
String.class
138-
);
139-
method.setAccessible(true);
140-
141-
String output = (String) method.invoke(
142-
null,
143-
"$ javac Solution.java\nwarning: unchecked conversion\nExit code: 0\n"
144-
);
145-
146-
assertTrue(output.startsWith("Compilation Output:\n"));
147-
assertTrue(output.contains("$ javac Solution.java"));
148-
assertTrue(output.contains("warning: unchecked conversion"));
149-
assertTrue(output.endsWith("\n\n"));
150-
}
151-
152-
@Test
153-
public void writePreResultMemberOutputIncludesCompilationOutputOnFailure()
133+
public void writePreResultMemberOutputLeavesCompilationInCompileLogOnFailure()
154134
throws Exception {
155135
Path artifactsDir = createArtifactsDir();
156136
Path outputPath = artifactsDir.resolve("public").resolve("output.txt");
@@ -165,22 +145,25 @@ public void writePreResultMemberOutputIncludesCompilationOutputOnFailure()
165145
Method method = EcsRunnerMain.class.getDeclaredMethod(
166146
"writePreResultMemberOutput",
167147
Path.class,
168-
Path.class,
169148
Throwable.class
170149
);
171150
method.setAccessible(true);
172151
method.invoke(
173152
null,
174153
outputPath,
175-
compileLogPath,
176154
new RuntimeException("C++ compilation failed.")
177155
);
178156

179157
String output = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8);
180-
assertTrue(output.contains("Compilation Output:"));
181-
assertTrue(output.contains("compile failed"));
158+
String compileLog = new String(
159+
Files.readAllBytes(compileLogPath),
160+
StandardCharsets.UTF_8
161+
);
162+
assertFalse(output.contains("Compilation Output:"));
163+
assertFalse(output.contains("compile failed"));
182164
assertTrue(output.contains("Runner Error:"));
183165
assertTrue(output.contains("C++ compilation failed."));
166+
assertTrue(compileLog.contains("compile failed"));
184167
}
185168

186169
@Test

0 commit comments

Comments
 (0)