Skip to content

Commit

Permalink
Merge branch 'main' into juj/ChangeEnergySupplierIdParamForJob
Browse files Browse the repository at this point in the history
  • Loading branch information
FirestarJes authored Oct 7, 2024
2 parents 6504f5b + 1aa0965 commit bffb2ab
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 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 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
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public SettlementReportMonthlyAmountRowMap()
Resolution.Hour => "PT1H",
Resolution.Day => "P1D",
Resolution.Month => "P1M",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.Resolution),
row.Value.Resolution,
"Value does not contain a enum representation of a Resolution"),
});

Map(r => r.QuantityUnit)
Expand All @@ -86,7 +89,10 @@ public SettlementReportMonthlyAmountRowMap()
null => string.Empty,
QuantityUnit.Kwh => "KWH",
QuantityUnit.Pieces => "PCS",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.QuantityUnit),
row.Value.QuantityUnit,
string.Empty),
});

Map(r => r.Currency)
Expand All @@ -95,7 +101,10 @@ public SettlementReportMonthlyAmountRowMap()
.Convert(row => row.Value.Currency switch
{
Currency.DKK => "DKK",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.Currency),
row.Value.Currency,
"Value does not contain a enum representation of a Currency"),
});

Map(r => r.Amount)
Expand All @@ -112,7 +121,10 @@ public SettlementReportMonthlyAmountRowMap()
ChargeType.Tariff => "D03",
ChargeType.Fee => "D02",
ChargeType.Subscription => "D01",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.ChargeType),
row.Value.ChargeType,
"Value does not contain a enum representation of a ChargeType"),
});

Map(r => r.ChargeCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,24 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor
Resolution.Hour => "PT1H",
Resolution.Day => "P1D",
Resolution.Month => "P1M",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.Resolution),
row.Value.Resolution,
"Value does not contain a enum representation of a Resolution."),
});

Map(r => r.QuantityUnit)
.Name("MEASUREUNIT")
.Index(6)
.Convert(row => row.Value.QuantityUnit switch
{
null => string.Empty,
QuantityUnit.Kwh => "KWH",
QuantityUnit.Pieces => "PCS",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.QuantityUnit),
row.Value.QuantityUnit,
"Value does not contain a enum representation of a quantity unit."),
});

Map(r => r.Currency)
Expand All @@ -100,7 +107,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor
.Convert(row => row.Value.Currency switch
{
Currency.DKK => "DKK",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.Currency),
row.Value.Currency,
"Value does not contain a enum representation of a Currency"),
});

Map(r => r.Amount)
Expand All @@ -117,7 +127,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor
ChargeType.Tariff => "D03",
ChargeType.Fee => "D02",
ChargeType.Subscription => "D01",
_ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)),
_ => throw new ArgumentOutOfRangeException(
nameof(row.Value.ChargeType),
row.Value.ChargeType,
"Value does not contain a enum representation of a ChargeType."),
});

Map(r => r.ChargeCode)
Expand Down

0 comments on commit bffb2ab

Please sign in to comment.