Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #945 +/- ##
==========================================
- Coverage 67.06% 67.05% -0.02%
==========================================
Files 123 123
Lines 43597 43653 +56
Branches 11143 11154 +11
==========================================
+ Hits 29240 29273 +33
- Misses 11212 11234 +22
- Partials 3145 3146 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 2, 2026 20:19
76abfa2 to
90e682b
Compare
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 8, 2026 09:45
90e682b to
b9b701a
Compare
calvinp0
marked this pull request as ready for review
August 8, 2026 09:48
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 8, 2026 12:40
b9b701a to
65adf9b
Compare
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 8, 2026 15:12
65adf9b to
b01ccf0
Compare
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 8, 2026 15:22
b01ccf0 to
575c947
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (1)
arc/main_test.py:581
- The
completed_job_recordsfixture here uses keys (adapter,run_time,status) that don't match the record schema produced byScheduler._record_completed_job()/ consumed by_compute_cost_metrics()(job_adapter,run_time_sec,job_status, pluslabel). Keeping the test data in the real schema will make the restart round-trip coverage more representative and avoids accidental drift in key naming.
records = [{'job_name': 'opt_a1', 'job_type': 'opt', 'adapter': 'gaussian',
'server': 'local', 'cpu_cores': 8, 'run_time': 12.5, 'status': 'done'}]
calvinp0
force-pushed
the
feature_cost_metrics
branch
4 times, most recently
from
August 10, 2026 09:15
1b241de to
0a9947b
Compare
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
August 10, 2026 19:36
0a9947b to
5a73846
Compare
calvinp0
force-pushed
the
feature_cost_metrics
branch
from
September 24, 2026 11:47
5a73846 to
8966314
Compare
The Scheduler now appends a lightweight record for every job that reaches `end_job`: job name, species label, job type, adapter, server, cpu cores, run time in seconds, and final status. The records accumulate on `Scheduler.completed_job_records` and are persisted in the restart file so a restarted run keeps its cost history. Pipe-mode tasks bypass the JobAdapter path and carry no per-task timing, so they are not individually recorded; only jobs ejected back to the Scheduler are.
Adds a `cost_metrics` section to output.yml, aggregating the per-job records the Scheduler collects into wall time, total job count, total execution time, total core hours, and a per-ESS breakdown. Jobs whose run time or core count could not be determined are counted in `jobs_missing_time` / `jobs_missing_cores` rather than being silently dropped, so a consumer can tell how complete the accounting is. `_timedelta_to_seconds()` normalizes the several shapes a run time arrives in (`timedelta`, numeric seconds, `H:MM:SS`, `D days, H:MM:SS`), returning None rather than raising on an unparseable value. `write_output_yml()` gains a `completed_job_records` argument alongside the existing `t0`; both default to None, so a caller that supplies neither gets an empty `cost_metrics` block rather than a missing key.
`ARC` hands the Scheduler's records to `write_output_yml()` so the run's `cost_metrics`
are populated, and accepts them back as a constructor argument so they survive a restart.
That second half matters more than it looks. `ARC.py` restarts a project with
`ARC(**read_yaml_file('restart.yml'))`, so the restart file is also ARC's constructor
namespace - but it is `ARC.as_dict()` plus whatever `Scheduler.save_restart_dict()` adds
to it. Persisting the records without a matching constructor parameter therefore makes
every restart of a project that has accumulated any fail immediately with
`TypeError: got an unexpected keyword argument`. `as_dict()` emits the key when non-empty
so the round trip is symmetric, and a restart file written before the key existed still
constructs.
`TestRestartRoundTrip` asserts that every key written into a restart dictionary - by
`as_dict()` and by the Scheduler - is a constructor parameter. That invariant previously
had no coverage at all: `ARC(**read_yaml_file(restart.yml))` was exercised by no test, so
this class of breakage stayed invisible until somebody restarted an affected project. Any
future key added to `Scheduler.save_restart_dict()` without touching `main.py` now fails
a test instead of a run.
alongd
force-pushed
the
feature_cost_metrics
branch
from
September 26, 2026 20:47
8966314 to
4c35867
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A
cost_metricssection inoutput.yml, answering "what did this run actually cost?":Three layers, one per commit:
arc/scheduler.py— the Scheduler appends a lightweight record for every job reachingend_job(name, label, job type, adapter, server, cpu cores, run time, status). Pipe-mode tasks bypass theJobAdapterpath and carry no per-task timing, so they are deliberately not recorded; only jobs ejected back to the Scheduler are.arc/output.py—_compute_cost_metrics()aggregates them;_timedelta_to_seconds()normalizes the several shapes a run time arrives in (timedelta, numeric seconds,H:MM:SS,D days, H:MM:SS), returningNonerather than raising on an unparseable value.arc/main.py— wires the records through towrite_output_yml(), and accepts them back on restart.Incomplete accounting is counted, not hidden
Jobs with no recorded run time or core count land in
jobs_missing_time/jobs_missing_coresinstead of being silently dropped, so a consumer can tell how complete the numbers are. A run where a third of jobs lack timing produces a visibly partial total rather than a confidently wrong one.The restart half is a real bug fix, not plumbing
Persisting the records is what makes them survive a restart — and that is exactly where this bit us in practice:
ARC.pyrestarts withARC(**read_yaml_file('restart.yml')), so the restart file is ARC's constructor namespace — but it isARC.as_dict()plus whateverScheduler.save_restart_dict()adds to it. Writing the records there without a matching constructor parameter makes every restart of a project that has accumulated any fail instantly.as_dict()now emits the key when non-empty so the round trip is symmetric, and a restart file written before the key existed still constructs.TestRestartRoundTripasserts that every key written into a restart dictionary — byas_dict()and by the Scheduler — is a constructor parameter. That invariant had no coverage at all:ARC(**read_yaml_file(restart.yml))was exercised by no test, which is why this class of breakage stays invisible until somebody actually restarts. Any future key added toScheduler.save_restart_dict()without touchingmain.pynow fails a test instead of a multi-day run.Evidence
222 tests pass (
output_test,main_test,scheduler_test), including 20 new ones:_timedelta_to_secondsacross all input shapes,_compute_cost_metricsaggregation / missing-data counting / unknown-adapter bucketing, thecost_metricssection end-to-end throughwrite_output_yml, and the four restart round-trip guards.Notes for review
scheduler.py|output.py+tests+docs |main.py+tests), so the three are independently readable.write_output_yml()'s newcompleted_job_recordsdefaults toNone, alongside the existingt0; a caller supplying neither gets an emptycost_metricsblock rather than a missing key.restart.ymlwritten by this branch carriescompleted_job_records, which an ARC predating it cannot accept:ARC.pysplats the file straight into the constructor and neither signature takes**kwargs, so running an older ARC against it raises the sameTypeErrorabove, naming the new key. The key is only written once at least one job has completed, and deleting that one line fromrestart.ymlrestores compatibility. The upgrade direction — the one that actually happens — is safe and covered: a restart file written before the key existed still constructs, and this branch removes no constructor parameter.ts_guessesexport, and that is the version kept here.