Fix #58: record task persistence through a single QuantumTaskRecorder - #105
Open
corgab wants to merge 3 commits into
Open
Fix #58: record task persistence through a single QuantumTaskRecorder#105corgab wants to merge 3 commits into
corgab wants to merge 3 commits into
Conversation
…ecorder SubmitQuantumCircuit::persistSubmission() and PollQuantumTask::persist() repeated the same shape: return early unless aether.persist_tasks is on, try a write, report() and swallow any Throwable. Only the write differed. Tasks\QuantumTaskRecorder now owns that guard and safety net once, with recordSubmission() for the insert and recordProgress() for the status, counts and error mirror. Both jobs resolve it from the container and call it, so the persistence rules live in one class with their own tests. Closes #58
…the duplicated persistence tests The recorder is now a handle() dependency like QuantumManager and the event Dispatcher, instead of being located with app() inside the method. The two PersistenceTest cases that only exercised the persist_tasks gate are gone: that rule is pinned by the recorder's own tests, and PersistenceTest keeps the job-level cases (what each job records, and when).
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.
Summary
SubmitQuantumCircuit::persistSubmission()andPollQuantumTask::persist()repeated the same shape: return early unlessaether.persist_tasksis on, try a database write,report()and swallow anyThrowable. Only the write itself differed. This PR moves the guard and the safety net into one collaborator, as the issue proposes.Plan
Tasks\QuantumTaskRecorderwithrecordSubmission(taskArn, driver, circuit)andrecordProgress(taskArn, status, counts, error); a privatewrite()applies thepersist_tasksgate and the report-and-swallow once for both.handle(), next toQuantumManagerand the eventDispatcher, and delete the jobs' private persistence methods.PersistenceTestfor what the jobs record and when.Changes
src/Tasks/QuantumTaskRecorder.php(new): the two record methods,enabled(), and the sharedwrite()wrapper. The docblocks carry the reasoning that used to sit on the job methods (the remote task already exists, so a failed write must never fail the job, retry a billable submission or suppressCircuitCompleted).src/Jobs/SubmitQuantumCircuit.php:handle(QuantumManager, QuantumTaskRecorder);persistSubmission()removed; one recorder call aftersubmitCircuit().src/Jobs/PollQuantumTask.php:handle(QuantumManager, Dispatcher, QuantumTaskRecorder);persist()removed; the five call sites callrecordProgress().CLAUDE.md: convention noted.tests/Feature/Tasks/QuantumTaskRecorderTest.php(new): gate on/off with a query-log check, the insert, intermediate status, success, error, unknown task left alone, and a dropped table proving both writes report through the exception handler and throw nothing.tests/Feature/PersistenceTest.php: the two cases that only exercised thepersist_tasksgate are gone (the recorder tests own that rule); the job-level cases stay. The job tests'handle()calls pass the recorder.Overlap
#104 (#57) also adds a
handle()parameter to both jobs and rewrites the same persistence methods to readpersist_tasksthroughAetherConfig. Whichever merges second keeps both parameters, deletes the methods in favour of the recorder, and has the recorder'senabled()readAetherConfig::persistTasks()instead of theconfig()helper.Tests
vendor/bin/pint --testpasses.vendor/bin/pest --compact: 797 tests, 1 skipped (791 before: +8 recorder tests, −2 duplicated gate tests).Closes #58