Skip to content

Commit

Permalink
Fix - still fail job even with S3 bucket failures
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Sep 6, 2023
1 parent 5e5312f commit d411fb5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/SIL.Machine.AspNetCore/Services/ClearMLNmtEngineBuildJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,17 @@ await _engines.UpdateAsync(
}
catch (Exception e)
{
_logger.LogError(0, e, $"Build faulted ({buildId}) because of exception {e.GetType().Name}:{e.Message}.");

try
{
await _sharedFileService.DeleteAsync($"builds/{buildId}/", CancellationToken.None);
}
catch (HttpRequestException)
catch (Exception e2)
{
_logger.LogError("Unable to access S3 bucket. Likely, the AWS credentials are invalid.");
throw;
_logger.LogError(
$"Unable to access S3 bucket to delete clearml job {buildId} because it threw the exception {e2.GetType().Name}:{e2.Message}."
);
}

await _engines.UpdateAsync(
Expand All @@ -233,7 +236,6 @@ await _engines.UpdateAsync(
);

await _platformService.BuildFaultedAsync(buildId, e.Message, CancellationToken.None);
_logger.LogError(0, e, "Build faulted ({0})", buildId);
throw;
}
}
Expand Down

0 comments on commit d411fb5

Please sign in to comment.