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: do not repeatedly remove already awaited tasks from subtask list #220

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

lzaoral
Copy link
Contributor

@lzaoral lzaoral commented Aug 22, 2023

Plain TaskBase.wait() always uses the whole list of all subtasks as the set of subtasks that should be awaited. Therefore, it will try to await even tasks that were already awaited in some previous TaskBase.wait() call and are no longer present in self._subtask_list which will subsequently raise the ValueError shown below.

Keep the set of already awaited tasks and skip their IDs when marking newly awaited subtasks as finished.

Fixes the following traceback:

Traceback (most recent call last):
  File "/src/kobo/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/src/osh/worker/tasks/task_errata_diff_build.py", line 55, in run
    self.wait()
  File "/src/kobo/kobo/worker/task.py", line 147, in wait
    self._subtask_list.remove(i)
ValueError: list.remove(x): x not in list

@rohanpm
Copy link
Member

rohanpm commented Aug 23, 2023

I think you missed a word "not" in the PR summary.

Plain TaskBase.wait() always uses the **whole** list of all subtasks as
the set of subtasks that should be awaited.  Therefore, it will try to
await even tasks that were already awaited in some previous
TaskBase.wait() call and are no longer present in self._subtask_list
which subsequently raise the ValueError shown below.

Keep the set of already awaited tasks and skip their IDs when marking
newly awaited subtasks as finished.

Fixes the following traceback:
```
Traceback (most recent call last):
  File "/src/kobo/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/src/osh/worker/tasks/task_errata_diff_build.py", line 55, in run
    self.wait()
  File "/src/kobo/kobo/worker/task.py", line 147, in wait
    self._subtask_list.remove(i)
ValueError: list.remove(x): x not in list
```
@lzaoral lzaoral changed the title worker: do repeatedly remove already awaited tasks from subtask list worker: do not repeatedly remove already awaited tasks from subtask list Aug 23, 2023
@rohanpm rohanpm merged commit 00c9013 into release-engineering:master Aug 24, 2023
15 checks passed
@lzaoral lzaoral deleted the fix-subtask-waiting branch August 24, 2023 05:57
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.

2 participants