diff --git a/CHANGES.md b/CHANGES.md index 9abd384f..a626ae31 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,16 @@ ones in. --> set in ``rose-suite.conf`` to be used when parsing ``global.cylc``. +## __cylc-rose-1.3.3 (Awaiting Release)__ + +### Fixes + +[#300](https://github.com/cylc/cylc-rose/pull/300) - +Fix issues which could cause "fcm_make" and "rose_prune" tasks intermittently +fail with the message +"Workflow database is incompatible with Cylc x.y.z, or is corrupted". + + ## __cylc-rose-1.3.2 (Released 2024-01-18)__ [#284](https://github.com/cylc/cylc-rose/pull/284) - Allow use of Metomi-Rose 2.2.*. diff --git a/cylc/rose/platform_utils.py b/cylc/rose/platform_utils.py index 91dd11a7..74435a5b 100644 --- a/cylc/rose/platform_utils.py +++ b/cylc/rose/platform_utils.py @@ -26,7 +26,11 @@ from cylc.flow.config import WorkflowConfig from cylc.flow.id_cli import parse_id -from cylc.flow.pathutil import get_workflow_run_pub_db_path +from cylc.flow.pathutil import ( + get_workflow_run_config_log_dir, + get_workflow_run_pub_db_path, +) +from cylc.flow.workflow_files import WorkflowFiles from cylc.flow.platforms import ( HOST_REC_COMMAND, get_platform, @@ -48,7 +52,11 @@ def get_platform_from_task_def(flow: str, task: str) -> Dict[str, Any]: Returns: Platform Dictionary. """ - _, _, flow_file = parse_id(flow, constraint='workflows', src=True) + workflow_id, _, _ = parse_id(flow, constraint='workflows', src=True) + flow_file = get_workflow_run_config_log_dir( + workflow_id, + WorkflowFiles.FLOW_FILE_PROCESSED, + ) config = WorkflowConfig(flow, flow_file, Values()) # Get entire task spec to allow Cylc 7 platform from host guessing. task_spec = config.pcfg.get(['runtime', task]) diff --git a/tests/unit/test_platform_utils.py b/tests/unit/test_platform_utils.py index b2ad95f1..b60fe7d4 100644 --- a/tests/unit/test_platform_utils.py +++ b/tests/unit/test_platform_utils.py @@ -117,7 +117,8 @@ def fake_flow(): flow_name: str = f'cylc-rose-platform-utils-test-{str(uuid4())[:6]}' flow_path = Path(os.path.expandvars('$HOME/cylc-run')) / flow_name flow_path.mkdir(parents=True) - (flow_path / 'flow.cylc').write_text(""" + flow_cylc = flow_path / 'flow.cylc' + flow_cylc.write_text(""" [scheduling] [[graph]] R1 = foo & bar & baz & qux & child_of_bar @@ -141,10 +142,12 @@ def fake_flow(): [[child_of_bar]] inherit = BAR """) + flow_processed = flow_path / 'log/config/flow-processed.cylc' + flow_processed.parent.mkdir(exist_ok=True, parents=True) + flow_processed.symlink_to(flow_path / 'flow.cylc') # Set up a database db_file = get_workflow_run_pub_db_path(flow_name) - Path(db_file).parent.mkdir() with CylcWorkflowDAO(db_file, create_tables=True) as dao: conn = dao.connect() conn.execute(