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

hub: support creation of subtasks with an inherited worker from parent task #230

Merged

Conversation

lzaoral
Copy link
Contributor

@lzaoral lzaoral commented Oct 19, 2023

OpenScanHub expects the parent task and its subtasks to be executed on the
same worker. However, there is a race with the assign_task XML-RPC call
because it does not guarantee that the subtask won't be assigned to another
worker by the hub in the meantime.

This commit adds a support for creation of subtasks pre-assigned to the
same worker executing the parent task, thus, invalidating the necessary
condition for the race described above.

Related: openscanhub/openscanhub#156

... with worker and task state assertions.
…t task

OpenScanHub expects the parent task and its subtasks to be executed on the
same worker.  However, there is a race with the `assign_task` XML-RPC call
because it does not guarantee that the subtask won't be assigned to another
worker by the hub in the meantime.

This commit adds a support for creation of subtasks pre-assigned to the
same worker executing the parent task, thus, invalidating the necessary
condition for the race described above.

Related: openscanhub/openscanhub#156
lzaoral added a commit to lzaoral/openscanhub that referenced this pull request Oct 19, 2023
... to fix the following crash due to race between the automated task assignment
to workers by the hub and the `hub.worker.assign_task` XML-RPC method.

```
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/usr/lib/python3.9/site-packages/osh/worker/tasks/task_errata_diff_build.py", line 52, in run
    self.hub.worker.assign_task(subtask_id)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 598, in request
    result = transport_class.request(self, *args, **kwargs)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 511, in _single_request3
    return self.parse_response(response)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 861, in assign_task
    self.__lock(worker_id, new_state=TASK_STATES["ASSIGNED"], initial_states=(TASK_STATES["FREE"], TASK_STATES["CREATED"]))
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 836, in __lock
    raise ObjectDoesNotExist()
django.core.exceptions.ObjectDoesNotExist
```

Related:  release-engineering/kobo#230
Resolves: openscanhub#156
Resolves: https://issues.redhat.com/browse/OSH-358
@rohanpm rohanpm merged commit 4e81c06 into release-engineering:master Oct 19, 2023
15 checks passed
@lzaoral lzaoral deleted the hub-create-preassigned-subtasks branch October 20, 2023 06:14
lzaoral added a commit to lzaoral/openscanhub that referenced this pull request Oct 26, 2023
... to fix the following crash due to race between the automated task assignment
to workers by the hub and the `hub.worker.assign_task` XML-RPC method.

This commit also introduces a hard dependency on Kobo 0.32.0 or newer.

```
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/usr/lib/python3.9/site-packages/osh/worker/tasks/task_errata_diff_build.py", line 52, in run
    self.hub.worker.assign_task(subtask_id)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 598, in request
    result = transport_class.request(self, *args, **kwargs)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 511, in _single_request3
    return self.parse_response(response)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 861, in assign_task
    self.__lock(worker_id, new_state=TASK_STATES["ASSIGNED"], initial_states=(TASK_STATES["FREE"], TASK_STATES["CREATED"]))
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 836, in __lock
    raise ObjectDoesNotExist()
django.core.exceptions.ObjectDoesNotExist
```

Related:  release-engineering/kobo#230
Resolves: openscanhub#156
Resolves: https://issues.redhat.com/browse/OSH-358
lzaoral added a commit to lzaoral/openscanhub that referenced this pull request Nov 2, 2023
... to fix the following crash due to race between the automated task assignment
to workers by the hub and the `hub.worker.assign_task` XML-RPC method.

This commit also introduces a hard dependency on Kobo 0.32.0 or newer.

```
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/usr/lib/python3.9/site-packages/osh/worker/tasks/task_errata_diff_build.py", line 52, in run
    self.hub.worker.assign_task(subtask_id)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 598, in request
    result = transport_class.request(self, *args, **kwargs)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 511, in _single_request3
    return self.parse_response(response)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 861, in assign_task
    self.__lock(worker_id, new_state=TASK_STATES["ASSIGNED"], initial_states=(TASK_STATES["FREE"], TASK_STATES["CREATED"]))
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 836, in __lock
    raise ObjectDoesNotExist()
django.core.exceptions.ObjectDoesNotExist
```

Related:  release-engineering/kobo#230
Resolves: openscanhub#156
Resolves: https://issues.redhat.com/browse/OSH-358
lzaoral added a commit to lzaoral/openscanhub that referenced this pull request Nov 8, 2023
... to fix the following crash due to race between the automated task assignment
to workers by the hub and the `hub.worker.assign_task` XML-RPC method.

This commit also introduces a hard dependency on Kobo 0.32.0 or newer.

```
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/usr/lib/python3.9/site-packages/osh/worker/tasks/task_errata_diff_build.py", line 52, in run
    self.hub.worker.assign_task(subtask_id)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 598, in request
    result = transport_class.request(self, *args, **kwargs)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 511, in _single_request3
    return self.parse_response(response)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 861, in assign_task
    self.__lock(worker_id, new_state=TASK_STATES["ASSIGNED"], initial_states=(TASK_STATES["FREE"], TASK_STATES["CREATED"]))
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 836, in __lock
    raise ObjectDoesNotExist()
django.core.exceptions.ObjectDoesNotExist
```

Related:  release-engineering/kobo#230
Resolves: openscanhub#156
Resolves: https://issues.redhat.com/browse/OSH-358
lzaoral added a commit to lzaoral/openscanhub that referenced this pull request Nov 8, 2023
... to fix the following crash due to race between the automated task assignment
to workers by the hub and the `hub.worker.assign_task` XML-RPC method.

This commit also introduces a hard dependency on Kobo 0.32.0 or newer.

```
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/kobo/worker/taskmanager.py", line 423, in run_task
    task.run()
  File "/usr/lib/python3.9/site-packages/osh/worker/tasks/task_errata_diff_build.py", line 52, in run
    self.hub.worker.assign_task(subtask_id)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 598, in request
    result = transport_class.request(self, *args, **kwargs)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/site-packages/kobo/xmlrpc.py", line 511, in _single_request3
    return self.parse_response(response)
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib64/python3.9/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 861, in assign_task
    self.__lock(worker_id, new_state=TASK_STATES["ASSIGNED"], initial_states=(TASK_STATES["FREE"], TASK_STATES["CREATED"]))
  File "/usr/lib/python3.6/site-packages/kobo/hub/models.py", line 836, in __lock
    raise ObjectDoesNotExist()
django.core.exceptions.ObjectDoesNotExist
```

Related:  release-engineering/kobo#230
Resolves: openscanhub#156
Resolves: https://issues.redhat.com/browse/OSH-358
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