Skip to content

Commit

Permalink
save icp somewhere different
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Aug 22, 2024
1 parent bfd7746 commit 1fcacc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 5 additions & 1 deletion cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ def process_initial_cycle_point(self) -> None:
Sets:
self.initial_point
self.cfg['scheduling']['initial cycle point']
self.raw_icp
Raises:
WorkflowConfigError - if it fails to validate
"""
Expand All @@ -709,7 +710,10 @@ def process_initial_cycle_point(self) -> None:
icp = ingest_time(orig_icp, get_current_time_string())
except IsodatetimeError as exc:
raise WorkflowConfigError(str(exc))

# Save un-evaluated point for DB
self.raw_icp = None
if icp != orig_icp:
self.raw_icp = icp
self.initial_point = get_point(icp).standardise()
self.cfg['scheduling']['initial cycle point'] = str(self.initial_point)

Expand Down
16 changes: 7 additions & 9 deletions cylc/flow/workflow_db_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,18 +328,16 @@ def put_workflow_params(self, schd: 'Scheduler') -> None:
{"key": self.KEY_STOP_TASK, "value": schd.stop_task},
])

# Special handling for Initial cycle point becuase we don't want
# to change the options object
# https://github.com/cylc/cylc-flow/issues/6262
icp = schd.config.initial_point
icp = None if icp == 'reload' else icp
self.put_workflow_params_1(self.KEY_INITIAL_CYCLE_POINT, str(icp))

for key in {
# Retrieve raw initial cycle point stored on the config.
value = getattr(schd.config, 'raw_icp', None)
value = None if value == 'reload' else value
self.put_workflow_params_1(self.KEY_INITIAL_CYCLE_POINT, value)

for key in (
self.KEY_FINAL_CYCLE_POINT,
self.KEY_START_CYCLE_POINT,
self.KEY_STOP_CYCLE_POINT
}:
):
value = getattr(schd.options, key, None)
value = None if value == 'reload' else value
self.put_workflow_params_1(key, value)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def test_process_icp(
assert mocked_config.cfg[
'scheduling']['initial cycle point'] == expected_icp
assert str(mocked_config.initial_point) == expected_icp
opt_icp = mocked_config.options.icp
opt_icp = mocked_config.raw_icp
if opt_icp is not None:
opt_icp = str(loader.get_point(opt_icp).standardise())
assert opt_icp == expected_opt_icp
Expand Down

0 comments on commit 1fcacc5

Please sign in to comment.