From e8954cf0d52f6e9b4b97b2405e51c9e2c951a73f Mon Sep 17 00:00:00 2001 From: Hilary James Oliver Date: Sun, 21 Jan 2024 11:09:47 +1300 Subject: [PATCH] Clean up task logging prefix. --- cylc/flow/scheduler.py | 2 +- cylc/flow/task_proxy.py | 11 ++++------- .../hold-release/14-hold-kill/flow.cylc | 2 +- tests/functional/hold-release/11-retrying/flow.cylc | 8 ++++---- .../pause-resume/12-pause-then-retry/flow.cylc | 4 ++-- tests/integration/test_reload.py | 2 +- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index b2227368ad7..596ed4f42a2 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -604,7 +604,7 @@ 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 format: [CYCLE/TASK/JOB(FLOWS):STATUS] - LOG MESSAGE" + "Task log prefix: CYCLE/TASK[/JOB][(FLOWS)]:STATUS" ) LOG.info( f'Run mode: {self.config.run_mode()}', diff --git a/cylc/flow/task_proxy.py b/cylc/flow/task_proxy.py index cfac2454453..8fe2aa74b40 100644 --- a/cylc/flow/task_proxy.py +++ b/cylc/flow/task_proxy.py @@ -296,15 +296,12 @@ def __str__(self) -> str: Format: "//{}:status". """ - if self.state.status == TASK_STATUS_WAITING: - # Don't print pre-incremented submit number. - subnum = "__" - else: - subnum = f"{self.submit_num:02d}" + id_ = self.identity + if self.state.status != TASK_STATUS_WAITING: + id_ += f"/{self.submit_num:02d}" return ( - f"{self.identity}/{subnum}" - f"{stringify_flow_nums(self.flow_nums)}:{self.state}" + f"{id_}{stringify_flow_nums(self.flow_nums)}:{self.state}" ) def copy_to_reload_successor(self, reload_successor, check_output): diff --git a/tests/flakyfunctional/hold-release/14-hold-kill/flow.cylc b/tests/flakyfunctional/hold-release/14-hold-kill/flow.cylc index bdd82878ab1..9a2c51a88fd 100644 --- a/tests/flakyfunctional/hold-release/14-hold-kill/flow.cylc +++ b/tests/flakyfunctional/hold-release/14-hold-kill/flow.cylc @@ -9,7 +9,7 @@ echo '# killing "sleeper"' cylc kill "${CYLC_WORKFLOW_ID}//1/sleeper" cylc__job__poll_grep_workflow_log -E \ - '1/sleeper/__:waiting\(held\).* job killed' + '1/sleeper:waiting\(held\).* job killed' sleep 10 # sleep, should still be held after 10 seconds cylc dump -s -t "${CYLC_WORKFLOW_ID}" >'cylc-dump.out' diff --git a/tests/functional/hold-release/11-retrying/flow.cylc b/tests/functional/hold-release/11-retrying/flow.cylc index 61873f24da8..0e08699af09 100644 --- a/tests/functional/hold-release/11-retrying/flow.cylc +++ b/tests/functional/hold-release/11-retrying/flow.cylc @@ -24,20 +24,20 @@ t-retry-able => t-analyse '1/t-retry-able/01:running.* => waiting' cylc__job__poll_grep_workflow_log -E \ - '1/t-retry-able/__:waiting.* retrying in PT15S' + '1/t-retry-able:waiting.* retrying in PT15S' cylc hold "${CYLC_WORKFLOW_ID}//1/t-retry-able" cylc__job__poll_grep_workflow_log -E \ - '1/t-retry-able/__:waiting.* => waiting\(held\)' + '1/t-retry-able:waiting.* => waiting\(held\)' cylc release "${CYLC_WORKFLOW_ID}//1/t-retry-able" cylc__job__poll_grep_workflow_log -E \ - '1/t-retry-able/__:waiting\(held\).* => waiting' + '1/t-retry-able:waiting\(held\).* => waiting' cylc__job__poll_grep_workflow_log -E \ - '1/t-retry-able/__:waiting.* => waiting\(queued\)' + '1/t-retry-able:waiting.* => waiting\(queued\)' """ [[t-analyse]] script = """ diff --git a/tests/functional/pause-resume/12-pause-then-retry/flow.cylc b/tests/functional/pause-resume/12-pause-then-retry/flow.cylc index aec3bdd9b18..7be27343939 100644 --- a/tests/functional/pause-resume/12-pause-then-retry/flow.cylc +++ b/tests/functional/pause-resume/12-pause-then-retry/flow.cylc @@ -36,10 +36,10 @@ cylc play "${CYLC_WORKFLOW_ID}" cylc__job__poll_grep_workflow_log -E \ - '1/t-retry-able/__:waiting.* => waiting\(queued\)' + '1/t-retry-able:waiting.* => waiting\(queued\)' cylc__job__poll_grep_workflow_log -E \ - '1/t-submit-retry-able/__:waiting.* => waiting\(queued\)' + '1/t-submit-retry-able:waiting.* => waiting\(queued\)' """ [[t-retry-able]] script = """ diff --git a/tests/integration/test_reload.py b/tests/integration/test_reload.py index ee8f0e24472..5bd07c17af4 100644 --- a/tests/integration/test_reload.py +++ b/tests/integration/test_reload.py @@ -99,7 +99,7 @@ def change_state(_=0): [ # the task should have entered the preparing state before the # reload was requested - '[1/foo/__:waiting(queued)] => preparing(queued)', + '[1/foo:waiting(queued)] => preparing(queued)', # the reload should have put the workflow into the paused state 'Pausing the workflow: Reloading workflow', # reload should have waited for the task to submit