Skip to content

Commit

Permalink
fix: add protection to download createdtask
Browse files Browse the repository at this point in the history
  • Loading branch information
ereali-aneo committed Sep 12, 2024
1 parent 3718678 commit 20ce11b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ jobs:
run: |
mkdir /tmp/sockets
chmod 777 /tmp/sockets
docker run --rm -d --name htcmock -u $(id -u) -e ComputePlane__WorkerChannel__Address=/cache/worker.sock -e ComputePlane__AgentChannel__Address=/cache/agent.sock -v /tmp/sockets:/cache -v /tmp/Results:/tmp/Results dockerhubaneo/armonik_core_htcmock_test_worker:0.25.0
mkdir /tmp/test
chmod 777 /tmp/test
docker run --rm -d --name htcmock -u $(id -u) -e ComputePlane__WorkerChannel__Address=/cache/worker.sock -e ComputePlane__AgentChannel__Address=/cache/agent.sock -v /tmp/sockets:/cache -v /tmp/test/Results:/tmp/test/Results dockerhubaneo/armonik_core_htcmock_test_worker:0.25.0
- name: Run TaskReRunner
working-directory: src/TaskReRunner
Expand Down
17 changes: 12 additions & 5 deletions src/TaskDumper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,19 @@ await File.WriteAllTextAsync(folder + "Subtasks.json",
await foreach (var result in resultsCreated)
{
results[result.ResultId] = result;
var createdResponse = resultClient.GetResult(new GetResultRequest
{
ResultId = taskResponse.Task.PayloadId,
});
// Put subtask results in var folder + "Results"
await File.WriteAllBytesAsync(Path.Combine(folder + "Results",
result.ResultId),
await resultClient.DownloadResultData(taskResponse.Task.SessionId,
result.ResultId,
CancellationToken.None) ?? Encoding.ASCII.GetBytes(""));
if (createdResponse.Result.Status == ResultStatus.Completed)
{
await File.WriteAllBytesAsync(Path.Combine(folder + "Results",
result.ResultId),
await resultClient.DownloadResultData(taskResponse.Task.SessionId,
result.ResultId,
CancellationToken.None) ?? Encoding.ASCII.GetBytes(""));
}
}

await File.WriteAllTextAsync(folder + "CreatedResults.json",
Expand Down

0 comments on commit 20ce11b

Please sign in to comment.