Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate long Cromwell failure messages #635

Merged
merged 3 commits into from
Apr 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/TriggerService/TriggerHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,24 @@ await storage.UploadFileTextAsync(
private async Task<WorkflowFailureInfo> GetWorkflowFailureInfoAsync(Guid workflowId, string metadata)
{
const string BatchExecutionDirectoryName = "__batch";
const int maxFailureMessageLength = 4096;

var metadataFailures = string.IsNullOrWhiteSpace(metadata)
? default
: JsonConvert.DeserializeObject<CromwellMetadata>(metadata)?.Failures;

if (metadataFailures?.Count > 0)
{
// Truncate failure messages; some can be 56k+ when it's an HTML message
for (int i = 0; i < metadataFailures.Count; i++)
{
if (metadataFailures[i].Message?.Length > maxFailureMessageLength)
{
metadataFailures[i].Message = $"{metadataFailures[i].Message[..maxFailureMessageLength]} [TRUNCATED by Cromwell On Azure's Trigger Service]";
}
}
}

var tesTasks = await tesTaskRepository.GetItemsAsync(t => t.WorkflowId == workflowId.ToString());

// Select the last attempt of each Cromwell task, and then select only the failed ones
Expand Down