Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker.timeout_task does not timeout task if recursive #72

Closed
alexandrevicenzi opened this issue Oct 26, 2018 · 1 comment · Fixed by #74
Closed

Worker.timeout_task does not timeout task if recursive #72

alexandrevicenzi opened this issue Oct 26, 2018 · 1 comment · Fixed by #74

Comments

@alexandrevicenzi
Copy link
Contributor

Worker.timeout_task interrupt subtasks if recursive is True and the task has subtasks.
The subtasks are set to INTERRUPTED but they should be set to TIMEOUT.

This is the current code of timeout_task:

    def timeout_task(self, recursive=True):
        """Set the task state to timeout."""
        try:
            self.__lock(self.worker_id, new_state=TASK_STATES["TIMEOUT"], initial_states=(TASK_STATES["OPEN"], ))
        except (MultipleObjectsReturned, ObjectDoesNotExist):
            raise Exception("Cannot interrupt task %d, state is %s" % (self.id, self.get_state_display()))

        if recursive:
            for task in self.subtasks():
                task.interrupt_task(recursive=True)
        self.logs.gzip_logs()

It's a very silly mistake, looks like it was copy and paste and someone forgot to change it.

@alexandrevicenzi
Copy link
Contributor Author

Fixed by #74.

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 a pull request may close this issue.

1 participant