Actively notfiy a job of an abort request #1084
Labels
Issue appropriate for: Occasional contributors 😉
This issue will be best tackled by people with a minimum of experience on the project
Issue contains: Some Python 🐍
This issue involves writing some Python code
Issue contains: Some SQL 🐘
This features require changing the SQL model
Issue status: Blocked ⛔️
Issue cannot be processed for now
Issue type: Feature ⭐️
Add a new feature that didn't exist before
With PR #1081, we added a feature to mark a currently running job for abortion, but we have to poll the database in the task ourselves to determine whether this mark was set (represented by the
aborting
status). As discussed in #511, it would be nice if the task was actively notified of an abortion (without the need for intense database polling) using a PostgreSQL listen-notify. We could then raise anasyncio.CancelledError
in an async task. It's unclear what to do with a sync task (maybe a callback method likecontext.listen_abort(cb: Callable
?!). It should be optional and triggered by something likejob_manager.cancel_job_by_id(33, abort=True, notify=True)
.It would be best implemented after the worker refactoring #933, as it must be integrated into the worker class.
The text was updated successfully, but these errors were encountered: