Skip to content

Fix Task Canceling#471

Draft
magniloquency wants to merge 5 commits intofinos:mainfrom
magniloquency:fix-task-balance
Draft

Fix Task Canceling#471
magniloquency wants to merge 5 commits intofinos:mainfrom
magniloquency:fix-task-balance

Conversation

@magniloquency
Copy link
Contributor

@magniloquency magniloquency commented Dec 16, 2025

This PR closes #242.

Root cause: VanillaWorkerController.on_task_cancel() didn't conform to its interface, because it did not return the worker ID. It also sent out the task cancel message, which the caller (VanillaTaskController.__send_task_cancel_to_worker()) was also set up to do, assuming the worker id was returned.

Solution: Ensure that the worker id is always returned and check for validity in the caller. Only actually send the cancel message in the vanilla task controller.

Recommendation: Python 3.12 introduced typing.override, which is available in pre-3.12 versions using typing_extensions, and enables type checking of overridden methods. Mypy also has an option to force all overridden methods to use the @override decorator. Mypy won't warn us for methods with a dynamic return type (no return type hint), but it might be possible for it to warn us on that as well.

@sharpener6
Copy link
Collaborator

@magniloquency, can you remind me why you closed this one?

@sharpener6 sharpener6 reopened this Mar 10, 2026
@magniloquency
Copy link
Contributor Author

@sharpener6, I closed this because, if I remember correctly, this PR fixed one problem but exposed another that would need fixes in the state machines. You said you would take a look at it, so I closed this PR thinking that you would raise your own

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.

Investigate "cannot find task in worker to cancel" error

2 participants