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

Task bundling #183

Open
j-woz opened this issue Dec 16, 2019 · 2 comments
Open

Task bundling #183

j-woz opened this issue Dec 16, 2019 · 2 comments

Comments

@j-woz
Copy link
Contributor

j-woz commented Dec 16, 2019

Some way to couple tasks in the queue. Could be solved with launch_multi(), but other features may be needed.

CC @jozik @ncollier

@jozik
Copy link
Contributor

jozik commented Dec 16, 2019

Adding some background about task granularity:
To encompass a set of tasks with, e.g., a bracket, that would tell Swift that these tasks should all be executed in one go, i.e., that they wouldn’t be individually placed in the queue and get executed when their turn in the queue comes.

One use case where this would be helpful is for post-run cleanup tasks, for example, when you want to make sure that all the cleanup has occurred before other tasks that might create more files (and thereby hit some file size or number threshold) are run.

@jozik
Copy link
Contributor

jozik commented Oct 8, 2021

We realized in our 10/8/21 discussion that this task bundling can be implemented using priorities.

E.g., in the case of a sim task (S) and a cleanup task ( C), if we give S priority 1 (p1) and C priority 2 (p2), with p2 being a higher priority than p1, and have 2N combined S and C tasks:

1: [S p1, C p2]
...
N: [S p1, C p2]
N+1: [S p1, C p2]
...
2N: [S p1, C p2]

The first N S tasks will run first, with the next N S tasks in the task queue.
As one of the first N S tasks completes, just before it does, it will release a C task into the queue, such that when it does complete and frees the worker, the C task will be the next to be run, rather than the N+1 - 2N S tasks. This way cleanup tasks that can run will run before any subsequent S tasks.

Is this enough to close this issue @j-woz, or do you think it warrants something beyond this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants