Skip to content

DM-54645: Add garbage collection metrics to task metadata#562

Open
andy-slac wants to merge 5 commits into
mainfrom
tickets/DM-54645
Open

DM-54645: Add garbage collection metrics to task metadata#562
andy-slac wants to merge 5 commits into
mainfrom
tickets/DM-54645

Conversation

@andy-slac
Copy link
Copy Markdown
Contributor

@andy-slac andy-slac commented May 28, 2026

SingleQuantumExecutor uses new GcMetrics context manager to collect
GC metrics and add them to task metadata under "quantum.gc_metrics" key.

Checklist

  • ran Jenkins
  • ran and inspected package-docs build
  • added a release note for user-visible changes to doc/changes

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 94.20290% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.75%. Comparing base (6cec3c9) to head (d993585).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
python/lsst/pipe/base/gc_metrics.py 92.45% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
- Coverage   88.77%   88.75%   -0.03%     
==========================================
  Files         159      160       +1     
  Lines       22053    22120      +67     
  Branches     2623     2625       +2     
==========================================
+ Hits        19578    19632      +54     
- Misses       1839     1848       +9     
- Partials      636      640       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andy-slac andy-slac changed the title Tickets/dm 54645 DM-54645: Add garbage collection metrics to task metadata May 28, 2026
@andy-slac andy-slac requested a review from Copilot May 28, 2026 19:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

This comment was marked as duplicate.

This comment was marked as duplicate.

This comment was marked as duplicate.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread python/lsst/pipe/base/single_quantum_executor.py
Comment thread python/lsst/pipe/base/gc_metrics.py Outdated
Comment thread python/lsst/pipe/base/gc_metrics.py Outdated
Comment thread python/lsst/pipe/base/gc_metrics.py
andy-slac added 3 commits May 28, 2026 14:18
SingleQuantumExecutor uses new GcMetrics context manager to collect
GC metrics and add them to task metadata under "quantum.gc_metrics" key.
Copy link
Copy Markdown
Member

@timj timj left a comment

Choose a reason for hiding this comment

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

Looks good. Minor questions.

Comment thread doc/changes/DM-54645.misc.md Outdated
Comment thread python/lsst/pipe/base/gc_metrics.py Outdated
"""GC thresholds on entering context."""

end_threshold: list[int] | None = None
"""GC thresholds on exiting context."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add units to the docstrings here.

start_isenabled: bool | None = None
"""Whether GC is enabled on entering context."""

end_isenabled: bool | None = None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You are worried a task is going to disable GC?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not worried, but I want to know if it happens. I imagine some tasks may want to do that (but they may also want to re-enable it on return).

Comment thread python/lsst/pipe/base/gc_metrics.py Outdated
return None

try:
return GcMetrics(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it more straightforward and future proofed to convert the TaskMetadata to a dictionary and then use the standard pydantic constructor from dict?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did not think about that, I'll try it.

andy-slac and others added 2 commits May 28, 2026 14:52
Co-authored-by: Tim Jenness <tjenness@lsst.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants