Skip to content

Commit 16e2cf0

Browse files
authored
Merge pull request #418 from mp-access/dev
v0.14.0
2 parents 80b02e0 + 520740e commit 16e2cf0

5 files changed

Lines changed: 661 additions & 457 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ jobs:
8383
- run:
8484
name: Send test coverage to Codacy
8585
command: |
86-
curl -Ls -o codacy-coverage-reporter-assembly.jar $(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({content_type, browser_download_url} | select(.content_type | contains("java-archive"))) | .[0].browser_download_url')
87-
java -jar codacy-coverage-reporter-assembly.jar report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml
86+
#curl -Ls -o codacy-coverage-reporter-assembly.jar $(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({content_type, browser_download_url} | select(.content_type | contains("java-archive"))) | .[0].browser_download_url')
87+
#java -jar codacy-coverage-reporter-assembly.jar report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml
88+
echo "Codacy parsing disabled until it works again"
8889
8990
- run:
9091
name: Create ACCESS local tester

src/main/java/ch/uzh/ifi/access/coderunner/CodeRunner.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,28 @@ private boolean startContainerWithTimeout(String containerId, long timeout, Time
173173
logger.error("Failed to start and wait for container", e);
174174
} catch (TimeoutException e) {
175175
logger.debug("Execution of student code took longer than configured timeout. Stopping container {}", containerId);
176-
docker.killContainer(containerId, DockerClient.Signal.SIGKILL);
176+
killContainer(containerId);
177177
didTimeout = true;
178178
}
179179
return didTimeout;
180180
}
181181

182+
private void killContainer(final String containerId) {
183+
try {
184+
docker.killContainer(containerId, DockerClient.Signal.SIGKILL);
185+
} catch (Exception nestedException) {
186+
logger.error("Something unexpected happened while trying to kill the container {}. " +
187+
"It might be that the container stopped right after the timeout limit, " +
188+
"but before it could be killed programmatically. Trying to pull info on container...", containerId, nestedException);
189+
try {
190+
ContainerState containerInfo = docker.inspectContainer(containerId).state();
191+
logger.warn("Container is still running: " + containerInfo.health().log());
192+
} catch (Exception healthException) {
193+
logger.error("Failed to pull health logs on container ${}. Will not attempt to dig any further.", containerId, healthException);
194+
}
195+
}
196+
}
197+
182198
private void copyDirectoryToContainer(String containerId, Path folder) throws InterruptedException, DockerException, IOException {
183199
docker.copyToContainer(folder, containerId, DOCKER_CODE_FOLDER);
184200
StringJoiner joiner = new StringJoiner("\n", String.format("Files copied to container @%s:\n", DOCKER_CODE_FOLDER), "").setEmptyValue("No files");

src/main/java/ch/uzh/ifi/access/student/evaluation/process/EvalMachineRepoService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ public void removeMachinesOlderThan(Instant threshold) {
4747
// A machine which has never completed and has been running for too long, should be removed
4848
boolean isZombieMachine = startedTime != null && startedTime.isBefore(threshold) && completionTime == null;
4949
if (isZombieMachine) {
50-
logger.info("Found a zombie machine {}. Started {}: {}", entry.getKey(), startedTime, machine.toString());
50+
logger.info("Found a zombie machine {}, will forcibly set state to {}. Started {}: {}", entry.getKey(), EvalMachine.Events.FINISH, startedTime, machine.toString());
51+
try {
52+
machine.sendEvent(EvalMachine.Events.FINISH);
53+
} catch (Exception e) {
54+
logger.error("Failed to forcibly set the state of the zombie machine to {}", EvalMachine.Events.FINISH, e);
55+
}
5156
}
5257

5358
// A machine which has completed normally and has finished for longer than threshold, can be safely removed

src/main/java/ch/uzh/ifi/access/student/evaluation/process/step/DelegateCodeExecStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public EvalMachine.Events execute(String submissionId) {
5252
submissionService.saveSubmission(submission);
5353

5454
} catch (InterruptedException | DockerException | IOException e) {
55-
logger.error(e.getMessage());
55+
logger.error("Something unexpected happened while attempting to run student code", e);
5656
}
5757
} else {
5858
logger.warn("Submission without registered exercise found (submissionId:" + submissionId + ").");

0 commit comments

Comments
 (0)