Call record_workflow_creation on every run - #5574
Conversation
first attempt, not on --restart, on the assumption that the local history database already had the workflow's row. Restarting from a different container/host breaks that assumption, since the history database is local to each machine, so record_workflow_attempt failed with FOREIGN KEY constraint failed at exit (#5544). Make record_workflow_creation idempotent (INSERT OR IGNORE, returns whether it created a new row) and call it on both the start and restart paths in Toil.__enter__, backfilling metadata only when the row didn't already exist so an already-known workflow's recorded creation time/name/TRS spec aren't overwritten.
| assert HistoryManager.record_workflow_creation(workflow_id, "file:/tmp/first") is True | ||
| assert HistoryManager.count_workflows() == 1 | ||
|
|
||
| assert HistoryManager.record_workflow_creation(workflow_id, "file:/tmp/second") is False |
There was a problem hiding this comment.
This is odd because the job store really shouldn't move like that.
There was a problem hiding this comment.
I guess it helps us see which call actually created the database entry, for the test.
|
It looks like this is breaking some of the existing tests for this system: |
|
I think merging this might have caused the CI failures we are seeing in mainline Toil in https://ucsc-ci.com/databiosphere/toil/-/pipelines/12468 Two different jobs failed with: I think the test maybe didn't work to start with but wasn't actually run in CI for this PR, because when I run the test with: I am able to see the same failure. I think we're not rolling back the transaction that produced the IntegrityError before trying to do more things with the caching database. |
Claude summarized that restarting a Toil workflow from a different container crashes at exit with a FOREIGN KEY constraint failed - the new container's local history database never recorded the workflow's creation, since that only happened on first attempts, not restarts.
Make record_workflow_creation idempotent, and call it on every run (not just first attempts) so a restart backfills the missing row before the workflow finishes.
We thought through whether this would cause trouble for Dockstore and decided it would not since Dockstore deals in attempts and not entire workflows.
Address #5544
Changelog Entry
To be copied to the draft changelog by merger:
Reviewer Checklist
issues/XXXX-fix-the-thingin the Toil repo, or from an external repo.camelCasethat want to be insnake_case.docs/running/{cliOptions,cwl,wdl}.rstMerger Checklist