Skip to content

Commit

Permalink
Merge branch 'multiburst-costs' into hyp3-multi-burst-sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
williamh890 committed Mar 7, 2025
2 parents bf4d9ac + c274da5 commit 9f46e02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/dynamo/dynamo/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _get_cost_from_table(job: dict, cost_definition: dict) -> Decimal:
parameter_value = int(parameter_value)

try:
cost_lookup = cost_lookup[parameter_value]
cost_lookup = cost_lookup[str(parameter_value)]
except KeyError:
raise ValueError(
f'Cost not found for job type {job["job_type"]} with {cost_parameter} == {parameter_value}'
Expand Down
36 changes: 18 additions & 18 deletions tests/test_dynamo/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,19 @@ def test_get_credit_cost():
'RTC_GAMMA': {
'cost_parameters': ['resolution'],
'cost_table': {
10: 60.0,
20: 15.0,
30: 5.0,
'10': 60.0,
'20': 15.0,
'30': 5.0,
},
},
'INSAR_ISCE_BURST': {'cost': 1.0},
'INSAR_ISCE_MULTI_BURST': {
'cost_parameters': ['looks', 'reference'],
'cost_table': {
'5x1': {
1: 1.0,
2: 1.0,
3: 10.0,
'1': 1.0,
'2': 1.0,
'3': 10.0,
}
},
},
Expand Down Expand Up @@ -248,19 +248,19 @@ def test_nested_credit_cost_lookup():
'cost_parameters': ['option1', 'option2', 'option3'],
'cost_table': {
'a': {
'x': {1: 11, 2: 21},
'y': {1: 12, 2: 22},
'z': {1: 13, 2: 23},
'x': {'1': 11, '2': 21},
'y': {'1': 12, '2': 22},
'z': {'1': 13, '2': 23},
},
'b': {
'x': {1: 14, 2: 24},
'y': {1: 15, 2: 25},
'z': {1: 16, 2: 26},
'x': {'1': 14, '2': 24},
'y': {'1': 15, '2': 25},
'z': {'1': 16, '2': 26},
},
'c': {
'x': {1: 17, 2: 27},
'y': {1: 18, 2: 28},
'z': {1: 19, 2: 29},
'x': {'1': 17, '2': 27},
'y': {'1': 18, '2': 28},
'z': {'1': 19, '2': 29},
},
},
}
Expand Down Expand Up @@ -442,9 +442,9 @@ def test_put_jobs_costs(tables, monkeypatch, approved_user):
'RTC_GAMMA': {
'cost_parameters': ['resolution'],
'cost_table': {
30: Decimal('5.0'),
20: Decimal('15.0'),
10: Decimal('60.0'),
'30': Decimal('5.0'),
'20': Decimal('15.0'),
'10': Decimal('60.0'),
},
},
'INSAR_ISCE_BURST': {
Expand Down

0 comments on commit 9f46e02

Please sign in to comment.