Skip to content

Simplify metrics handling in step()#7

Merged
rbx merged 1 commit intomasterfrom
refactor-step-metrics
Jan 20, 2026
Merged

Simplify metrics handling in step()#7
rbx merged 1 commit intomasterfrom
refactor-step-metrics

Conversation

@rbx
Copy link
Member

@rbx rbx commented Jan 20, 2026

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

This change refactors metric tracking from dictionary-based updates to attribute-based access on a MetricsTracker object across multiple modules (baseline, environment, and job_management), eliminating inline per-call metric dictionaries in favor of a shared instance.

Changes

Cohort / File(s) Summary
Metrics Access Pattern Refactor
src/baseline.py, src/job_management.py
Replaced dictionary key access (metrics['key']) with direct attribute access (metrics.key) for baseline metric counters including jobs_submitted, jobs_rejected_queue_full, jobs_completed, and max_queue_size_reached.
Metric Propagation Simplification
src/environment.py
Removed inline job_metrics and baseline_metrics dictionary construction. Updated assign_jobs_to_available_nodes() and baseline_step() calls to pass shared self.metrics instance instead of per-call dictionaries, reducing metric update complexity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to evaluate whether the description relates to the changeset. Add a pull request description explaining the motivation for refactoring metrics handling and any benefits of using a MetricsTracker object instead of dictionaries.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the pull request: refactoring metrics handling from dictionary-based to object attribute-based approach across multiple files in the step() execution path.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rbx rbx merged commit 0dca738 into master Jan 20, 2026
1 check passed
@rbx rbx deleted the refactor-step-metrics branch January 21, 2026 10:16
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.

1 participant