Skip to content

fix: use valid JobStatus for batch cancellation#517

Merged
chubes4 merged 1 commit intomainfrom
fix/batch-cancelled-status
Mar 3, 2026
Merged

fix: use valid JobStatus for batch cancellation#517
chubes4 merged 1 commit intomainfrom
fix/batch-cancelled-status

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 2, 2026

Summary

  • Bug: PipelineBatchScheduler::processChunk() was calling complete_job() with 'cancelled' as the status, but 'cancelled' is not in JobStatus::FINAL_STATUSES. The DB layer rejected the update silently, leaving the parent job stuck in 'processing'.
  • Fix: Uses JobStatus::failed('batch cancelled')->toString() which produces a valid compound status 'failed - batch cancelled'.
  • Test fix: Adds set_up_before_class() to PipelineBatchSchedulerTest to run datamachine_activate_for_site() — the activation hook doesn't fire in the test context, so plugin tables must be created explicitly.

Testing

All 10 PipelineBatchSchedulerTest assertions pass (53 total assertions):

Pipeline Batch Scheduler (DataMachine\Tests\Unit\Engine\PipelineBatchScheduler)
 ✔ Fanout creates batch metadata on parent
 ✔ Fanout stores transient
 ✔ Process chunk creates child jobs
 ✔ Process chunk respects cancellation
 ✔ Child labels use packet titles
 ✔ On child complete marks parent done when all children finish
 ✔ On child complete marks parent failed when all children fail
 ✔ Child jobs receive per item engine data
 ✔ Child jobs work without engine data key
 ✔ On child complete ignores non batch parents

Run with: homeboy test data-machine --skip-lint --path=<workspace> --setting database_type=mysql --setting mysql_database=extrachill --setting mysql_user=extrachill --setting mysql_password=<pw> -- --filter PipelineBatchSchedulerTest

PipelineBatchScheduler::processChunk() was calling complete_job() with
'cancelled' as the status, but 'cancelled' is not in JobStatus::FINAL_STATUSES.
The DB layer rejected the status update silently, leaving the parent job stuck
in 'processing'.

Fixed by using JobStatus::failed('batch cancelled')->toString() which produces
a valid compound status 'failed - batch cancelled'.

Also adds set_up_before_class() to PipelineBatchSchedulerTest to create
data-machine tables (activation hook doesn't fire in test context).
@chubes4 chubes4 merged commit d07ceec into main Mar 3, 2026
@chubes4 chubes4 deleted the fix/batch-cancelled-status branch March 3, 2026 01:00
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