Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging: update header timestamp on rollover #6546

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Jan 9, 2025

When the scheduler log rolls over, the header lines get logged with the original timestamp rather than the rollover time which is a tad confusing.

Test using:

# global.cylc

[scheduler]
  [[logging]]
    maximum size in bytes = 200

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).
  • Changelog entry included if this is a change that can affect users
  • 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 bug Something is wrong :( small labels Jan 9, 2025
@oliver-sanders oliver-sanders added this to the 8.4.1 milestone Jan 9, 2025
@oliver-sanders oliver-sanders self-assigned this Jan 9, 2025
@MetRonnie MetRonnie changed the base branch from master to 8.4.x January 9, 2025 18:32
@@ -238,15 +239,22 @@ def do_rollover(self) -> None:
os.dup2(self.stream.fileno(), sys.stderr.fileno())
# Emit header records (should only do this for subsequent log files)
for header_record in self.header_records:
now = time()
Copy link
Member

@wxtim wxtim Jan 15, 2025

Choose a reason for hiding this comment

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

IMO it's entirely reasonable not to test assigning the output of a standard library function, and marking this as not needing testing gives us a better idea of what is and isn't tested.

Suggested change
now = time()
now = time() # pragma: no cover

I'm now questioning whether Cov should even pick this up.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm confused, codecode says this is covered:

codecov/patch — 100.00% of diff hit (target 97.00%)

Copy link
Member

Choose a reason for hiding this comment

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

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot from 2025-01-15 16-36-48

Copy link
Member

@wxtim wxtim Jan 16, 2025

Choose a reason for hiding this comment

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

Whatev. Not super important. Wierd though. I think that you can merge this on one review if you want.

Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

  • Read code.
  • Manually tested.

Doesn't have a unit test, but perhaps the game isn't worth the candle for this change.

@oliver-sanders oliver-sanders merged commit b69873a into cylc:8.4.x Jan 16, 2025
27 checks passed
@oliver-sanders oliver-sanders deleted the log-rollover-time branch January 16, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants