Merge ~cjwatson/launchpad:extract-job-state-flush into launchpad:master
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 3e0bb9e55d00407d2dd1498ed1637f077ad5614f |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:extract-job-state-flush |
Merge into: | launchpad:master |
Diff against target: |
116 lines (+24/-18) 2 files modified
lib/lp/services/job/runner.py (+6/-0) lib/lp/services/job/tests/test_celery.py (+18/-18) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ines Almeida | Approve | ||
Review via email: mp+449126@code.launchpad.net |
Commit message
Flush store before extracting job state
Description of the change
Since converting `Job` to Storm in c69d6205ab, the store is no longer automatically flushed when the `id` column is fetched, so we have to be a little more careful to ensure that it's flushed at appropriate times. Some Celery tasks are currently showing up with their job IDs as None, indicating that this isn't always being done properly. This appears to be because the before-commit hook that extracts the job state runs before the Storm hook that flushes the store at the start of a commit, so if the statement that created the `Job` row hadn't yet been flushed for some other reason then we might not know the job ID yet.
The test suite evaded this problem because Celery-based job tests typically use `FeatureFixture`, which causes `BaseRunnableJo
Flushing the store before extracting the job state should be a complete fix for this class of problem.
Makes sense