fix: use valid JobStatus for batch cancellation#517
Merged
Conversation
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).
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
PipelineBatchScheduler::processChunk()was callingcomplete_job()with'cancelled'as the status, but'cancelled'is not inJobStatus::FINAL_STATUSES. The DB layer rejected the update silently, leaving the parent job stuck in'processing'.JobStatus::failed('batch cancelled')->toString()which produces a valid compound status'failed - batch cancelled'.set_up_before_class()toPipelineBatchSchedulerTestto rundatamachine_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):
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