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 c402a96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ jobs:
dotnet run --endpoint ${{ env.Grpc__Endpoint }} --taskId ${{ env.taskId }} --dataFolder /tmp/test
- name: Run Worker HtcMock
working-directory: src/TaskReRunner
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
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:/tmp/test -v ${{ github.workspace }}:${{ github.workspace }} 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 c402a96

Please sign in to comment.