Skip to content

Commit

Permalink
Only get status for running reports (#45)
Browse files Browse the repository at this point in the history
* Only get status for running reports

also remove parallel download.

* Update SettlementReportListHttpTrigger.cs
  • Loading branch information
FirestarJes authored Oct 4, 2024
1 parent 4edb5fa commit c3f4b4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ 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 (instanceInfo == 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;
}

if (settlementReport.Status == SettlementReportStatus.InProgress)
{
if (instanceInfo.RuntimeStatus
is OrchestrationRuntimeStatus.Terminated
or OrchestrationRuntimeStatus.Failed)
Expand All @@ -130,9 +130,9 @@ await _updateFailedSettlementReportsHandler
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 c3f4b4e

Please sign in to comment.