diff --git a/cylc/flow/flow_mgr.py b/cylc/flow/flow_mgr.py index 6cb9b642633..e371318a383 100644 --- a/cylc/flow/flow_mgr.py +++ b/cylc/flow/flow_mgr.py @@ -93,31 +93,36 @@ def stringify_flow_nums(flow_nums: Set[int], full: bool = False) -> str: Examples: >>> stringify_flow_nums({}) - '(none)' + '(flows=none)' >>> stringify_flow_nums({1}) '' >>> stringify_flow_nums({1}, True) - '(1)' + '(flows=1)' >>> stringify_flow_nums({1,2,3}) - '(1,2,3)' + '(flows=1,2,3)' """ if not full and flow_nums == {1}: return "" - return ( - "(" - f"{','.join(str(i) for i in flow_nums) or 'none'}" - ")" - ) + else: + return ( + "(flows=" + f"{','.join(str(i) for i in flow_nums) or 'none'}" + ")" + ) class FlowMgr: """Logic to manage flow counter and flow metadata.""" - def __init__(self, db_mgr: "WorkflowDatabaseManager", utc: bool) -> None: + def __init__( + self, + db_mgr: "WorkflowDatabaseManager", + utc: bool = True + ) -> None: """Initialise the flow manager.""" self.db_mgr = db_mgr self.flows: Dict[int, Dict[str, str]] = {} @@ -156,7 +161,7 @@ def get_flow_num( ) else: # Record a new flow. - now_sec = datetime.datetime.now(self._timezone).isoformat( + now_sec = datetime.datetime.now(tz=self._timezone).isoformat( timespec="seconds" ) meta = meta or "no description" diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index a15ff13ff50..09f25ecfff3 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -604,9 +604,6 @@ def log_start(self) -> None: # Note that the following lines must be present at the top of # the workflow log file for use in reference test runs. - LOG.info( - "Task log prefix: CYCLE/TASK[/JOB][(FLOWS)]:STATUS" - ) LOG.info( f'Run mode: {self.config.run_mode()}', extra=RotatingLogFileHandler.header_extra diff --git a/tests/functional/flow-triggers/13-noflow-nomerge.t b/tests/functional/flow-triggers/13-noflow-nomerge.t index d380268e449..8dfa08f994c 100644 --- a/tests/functional/flow-triggers/13-noflow-nomerge.t +++ b/tests/functional/flow-triggers/13-noflow-nomerge.t @@ -27,7 +27,7 @@ run_ok "${TEST_NAME_BASE}-run" cylc play "${WORKFLOW_NAME}" poll_grep_workflow_log "Workflow stalled" run_ok "${TEST_NAME_BASE}-trigger" cylc trigger --flow=none "${WORKFLOW_NAME}//1/a" -poll_grep_workflow_log -E "1/a/02\(none\):running.*=> succeeded" +poll_grep_workflow_log -E "1/a/02\(flows=none\):running.*=> succeeded" cylc stop --now --now --max-polls=5 --interval=2 "$WORKFLOW_NAME" diff --git a/tests/functional/restart/50-two-flows/flow.cylc b/tests/functional/restart/50-two-flows/flow.cylc index 1181e4e80cb..bd9de46c8b4 100644 --- a/tests/functional/restart/50-two-flows/flow.cylc +++ b/tests/functional/restart/50-two-flows/flow.cylc @@ -23,7 +23,7 @@ if ((CYLC_TASK_FLOW_NUMBERS == 1)); then cylc trigger --flow=new --meta="cheese wizard" \ "$CYLC_WORKFLOW_ID//1/a" - cylc__job__poll_grep_workflow_log -E "\[1/a/02\(2\):submitted\] => running" + cylc__job__poll_grep_workflow_log -E "\[1/a/02\(flows=2\):submitted\] => running" cylc stop $CYLC_WORKFLOW_ID fi """ diff --git a/tests/unit/test_flow_mgr.py b/tests/unit/test_flow_mgr.py index 52d865e861b..c9171b02073 100644 --- a/tests/unit/test_flow_mgr.py +++ b/tests/unit/test_flow_mgr.py @@ -26,6 +26,7 @@ FAKE_NOW = datetime.datetime(2020, 12, 25, 17, 5, 55) +FAKE_NOW_ISO = FAKE_NOW.isoformat() @pytest.fixture @@ -33,7 +34,7 @@ def patch_datetime_now(monkeypatch): class mydatetime: @classmethod - def now(cls): + def now(cls, tz=None): return FAKE_NOW monkeypatch.setattr(datetime, 'datetime', mydatetime) @@ -49,41 +50,40 @@ def test_all( flow_mgr = FlowMgr(db_mgr) caplog.set_level(logging.INFO, CYLC_LOG) - # automatic: expect flow number 1 meta = "the quick brown fox" assert flow_mgr.get_flow_num(None, meta) == 1 - msg1 = f"flow: 1 ({meta}) {FAKE_NOW}" + msg1 = f"flow: 1 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg1}" in caplog.messages # automatic: expect 2 meta = "jumped over the lazy dog" assert flow_mgr.get_flow_num(None, meta) == 2 - msg2 = f"flow: 2 ({meta}) {FAKE_NOW}" + msg2 = f"flow: 2 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg2}" in caplog.messages # give flow 2: not a new flow meta = "jumped over the moon" assert flow_mgr.get_flow_num(2, meta) == 2 - msg3 = f"flow: 2 ({meta}) {FAKE_NOW}" + msg3 = f"flow: 2 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg3}" not in caplog.messages assert f"Ignoring flow metadata \"{meta}\": 2 is not a new flow" in caplog.messages # give flow 4: new flow meta = "jumped over the cheese" assert flow_mgr.get_flow_num(4, meta) == 4 - msg4 = f"flow: 4 ({meta}) {FAKE_NOW}" + msg4 = f"flow: 4 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg4}" in caplog.messages # automatic: expect 3 meta = "jumped over the log" assert flow_mgr.get_flow_num(None, meta) == 3 - msg5 = f"flow: 3 ({meta}) {FAKE_NOW}" + msg5 = f"flow: 3 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg5}" in caplog.messages # automatic: expect 5 (skip over 4) meta = "crawled under the log" assert flow_mgr.get_flow_num(None, meta) == 5 - msg6 = f"flow: 5 ({meta}) {FAKE_NOW}" + msg6 = f"flow: 5 ({meta}) {FAKE_NOW_ISO}" assert f"New {msg6}" in caplog.messages flow_mgr._log() assert (