Skip to content

job log retrieval: remove duplicate logging#6934

Merged
ChrisPaulBennett merged 1 commit intocylc:8.5.xfrom
oliver-sanders:remove-duplicate-logging
Sep 3, 2025
Merged

job log retrieval: remove duplicate logging#6934
ChrisPaulBennett merged 1 commit intocylc:8.5.xfrom
oliver-sanders:remove-duplicate-logging

Conversation

@oliver-sanders
Copy link
Copy Markdown
Member

All subprocs are already logged at DEBUG level by the subprocpool:

LOG.debug(
ctx.dump() if isinstance(ctx, SubFuncContext) else ctx
)

So no need to repeat that just for job-log-retrieval.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed) - nope
  • Changelog entry included if this is a change that can affect users - irrelevant
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders oliver-sanders added this to the 8.5.x milestone Aug 21, 2025
@oliver-sanders oliver-sanders self-assigned this Aug 21, 2025
@hjoliver
Copy link
Copy Markdown
Member

One unit test needs adapting to the change.

@oliver-sanders oliver-sanders force-pushed the remove-duplicate-logging branch from 5f9091d to 1c4e2f2 Compare August 26, 2025 08:09
Comment on lines -29 to -45
@patch("cylc.flow.task_events_mgr.LOG")
def test_log_error_on_error_exit_code(cylc_log):
"""Test that an error log is emitted when the log retrieval command
exited with a code different than zero.

:param cylc_log: mocked cylc logger
:type cylc_log: mock.MagicMock
"""
task_events_manager = TaskEventsManager(
None, None, None, None, None, None, None, None, None)
proc_ctx = SubProcContext(
cmd_key=None, cmd="error", ret_code=1, err="Error!", id_keys=[])
task_events_manager._job_logs_retrieval_callback(proc_ctx, None)
assert cylc_log.error.call_count == 1
assert cylc_log.error.call_args.contains("Error!")


Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already covered by subprocpool tests, we don't need to test this specifically for job log retrieval commands.

@oliver-sanders oliver-sanders force-pushed the remove-duplicate-logging branch from 1c4e2f2 to 0c0c82f Compare August 29, 2025 10:04
Comment on lines -46 to -60
@patch("cylc.flow.task_events_mgr.LOG")
def test_log_debug_on_noerror_exit_code(cylc_log):
"""Test that a debug log is emitted when the log retrieval command
exited with an non-error code (i.e. 0).

:param cylc_log: mocked cylc logger
:type cylc_log: mock.MagicMock
"""
task_events_manager = TaskEventsManager(
None, None, None, None, None, None, None, None, None)
proc_ctx = SubProcContext(
cmd_key=None, cmd="ls /tmp/123", ret_code=0, err="", id_keys=[])
task_events_manager._job_logs_retrieval_callback(proc_ctx, None)
assert cylc_log.debug.call_count == 1
assert cylc_log.debug.call_args.contains("ls /tmp/123")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto!

Copy link
Copy Markdown
Contributor

@ChrisPaulBennett ChrisPaulBennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ChrisPaulBennett ChrisPaulBennett merged commit 2740c44 into cylc:8.5.x Sep 3, 2025
28 checks passed
@MetRonnie MetRonnie modified the milestones: 8.5.x, 8.5.2 Sep 3, 2025
@oliver-sanders oliver-sanders deleted the remove-duplicate-logging branch September 3, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants