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

Improve throughput for immediate tasks (1/3) #5841

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pedro-psb
Copy link
Member

@pedro-psb pedro-psb commented Sep 25, 2024

In busy tasking environments, "immediate" running tasks (which are only dispatched to workers due to resource locking requirements) can wait for very long behind long-running tasks, such as syncs and publishes.

This tries to solve this implementing the solution proposed in #5767, as discussed in the Pulp team.

@pedro-psb pedro-psb force-pushed the feat/run-immediate-tasks-on-parent branch from 7fb9d32 to d18b071 Compare September 25, 2024 21:36
@pedro-psb pedro-psb changed the title Rrun immediate tasks on worker parent process Improve throughput for immediate tasks (1/3) Sep 26, 2024
Comment on lines 349 to 352
.first()
)
with contextlib.suppress(AdvisoryLockError), task:
task.refresh_from_db()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.first() can return None. Will this not error trying to call a method on None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, nice catch.
But anyway, this was a sketch of the approach I had in mind, which won't be used.
I force pushed with the ideas I discussed with @mdellweg yesterday.

* Refatored handle_available_tasks for more clarity of the flow
* Refactored iter_tasks for more flow clarity and to prepare
  prioritizaton of immediate tasks.
* Added/changed misc comments, docstrings and names
@pedro-psb pedro-psb force-pushed the feat/run-immediate-tasks-on-parent branch from d18b071 to 9ab7302 Compare September 27, 2024 20:34
This defines tasks of the type "immediate" by adding a Task.immediate(bool)
field to the Task model. Non-immediate are called "long".

Then, these type of task is put in front of the line when the worker
queries for new available tasks.

Closes pulp#5767
@pedro-psb pedro-psb force-pushed the feat/run-immediate-tasks-on-parent branch from 9ab7302 to 589053b Compare September 27, 2024 20:46
@pedro-psb
Copy link
Member Author

(there is a refator and a impl commit)

@pedro-psb pedro-psb marked this pull request as ready for review September 28, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants