Skip to content

Commit

Permalink
Only get status for running reports
Browse files Browse the repository at this point in the history
also remove parallel download.
  • Loading branch information
FirestarJes committed Oct 4, 2024
1 parent f4a225f commit 21de03f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,40 +99,43 @@ private async Task<IEnumerable<RequestedSettlementReportDto>> CheckStatusOfSettl
{
var updatedReport = settlementReport;

var instanceInfo = await durableTaskClient
.GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true)
.ConfigureAwait(false);

if (instanceInfo == null)
if (settlementReport.Status == SettlementReportStatus.InProgress && settlementReport.JobId == null)
{
// If the orchestration instance is not found, we assume it is running on the other orchestration,
// either the heavy or the light one
continue;
}
var instanceInfo = await durableTaskClient
.GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true)
.ConfigureAwait(false);

if (settlementReport.Status == SettlementReportStatus.InProgress)
{
if (instanceInfo.RuntimeStatus
is OrchestrationRuntimeStatus.Terminated
or OrchestrationRuntimeStatus.Failed)
if (instanceInfo == null)
{
await _updateFailedSettlementReportsHandler
.UpdateFailedReportAsync(settlementReport.RequestId)
.ConfigureAwait(false);

updatedReport = settlementReport with { Status = SettlementReportStatus.Failed };
// If the orchestration instance is not found, we assume it is running on the other orchestration,
// either the heavy or the light one
continue;
}
else

if (settlementReport.Status == SettlementReportStatus.InProgress)
{
var customStatus = instanceInfo.ReadCustomStatusAs<OrchestrateSettlementReportMetadata>();
if (customStatus != null)
if (instanceInfo.RuntimeStatus
is OrchestrationRuntimeStatus.Terminated
or OrchestrationRuntimeStatus.Failed)
{
updatedReport = updatedReport with { Progress = customStatus.OrchestrationProgress };
await _updateFailedSettlementReportsHandler
.UpdateFailedReportAsync(settlementReport.RequestId)
.ConfigureAwait(false);

updatedReport = settlementReport with { Status = SettlementReportStatus.Failed };
}
else
{
var customStatus = instanceInfo.ReadCustomStatusAs<OrchestrateSettlementReportMetadata>();
if (customStatus != null)
{
updatedReport = updatedReport with { Progress = customStatus.OrchestrationProgress };
}
}
}
}

finalSettlementReports.Add(updatedReport);
finalSettlementReports.Add(updatedReport);
}
}

return finalSettlementReports;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal string BuildDebugString(DatabricksSqlQueryable query)

private IAsyncEnumerable<TElement> ExecuteCoreAsync<TElement>(DatabricksStatement databricksStatement, CancellationToken cancellationToken = default)
{
var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray).WithParallelDownload(), cancellationToken);
var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray), cancellationToken);
return _sqlRowHydrator.HydrateAsync<TElement>(rows, cancellationToken);
}

Expand Down

0 comments on commit 21de03f

Please sign in to comment.