Terminate subprocess when canceling #1361
Merged
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.
Within Girder and girder jobs itself when cancelling a job it calls celery
revoke()Girder Worker code: https://github.com/girder/girder_worker/blob/19b4fc3360a0c9d92fbd0ecd1bfab693f8c75ae7/girder_worker/girder_plugin/event_handlers.py#L142
Celery Reference for Revoke: https://docs.celeryq.dev/en/latest/userguide/workers.html#revoke-revoking-tasks
So it won't execute the task but it doesn't stop the execution of a currently running task.
This update checks in the logger for the Task to see if the task status is CANCELING. If it is it will then kill the subprocess used to run VIAME for both pipelines and training. Without this, the process needs to complete before the resources are released. This should make cancelling a task for training/pipelines actually kill the process itself.