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

Run tasks in parallel #27

Open
furudean opened this issue Jan 16, 2025 · 2 comments
Open

Run tasks in parallel #27

furudean opened this issue Jan 16, 2025 · 2 comments
Assignees

Comments

@furudean
Copy link

It would be nice if long-running tasks could be executed in parallel, like for example two notarization tasks with different settings.

Implementation could look something like: If the priorities are shared between two tasks, they will run at the same time. Maybe, a defer option could be added which means the task isn't blocking others from running.

@kobaltcore kobaltcore self-assigned this Jan 18, 2025
@kobaltcore
Copy link
Owner

That's a neat idea and I'm not averse to implementing support for this in some way.
It does come with some annoying implications, like having to ensure that the built-in tasks are as independent as possible, which they currently are not.
For example, if you were to run two notarization tasks at the same time, with the only difference being the signing identity, they'd extract to the same directory and would interfere with each other.

Fixing this effectively requires a sandboxing system, where tasks are not sandboxed by default and can opt-in to assert that they can be/are sandboxed/idempotent. This would likely be a breaking change in the task system again and require the release of v6 because the task interface would have to change to accommodate something like a 'sandbox path' that a sandboxed task can guarantee it will solely operate within.

It would also need to force every custom task to implement a new interface method to indicate support for this new feature, as only the task itself can assert this. For example, a user could assert sandboxing support in the config file, but if the task itself does not properly support it, that assertion creates a problem.
Breaking the interface with the latter could be avoided by defaulting to false when said interface method doesn't exist for a custom task, allowing for gradually updating them over time.

I'm thinking that if the sandboxing system above is implemented, renconstruct could then automatically parallelize where possible if:

  • two or more tasks share the same priority level
  • two or more of that set of tasks are sandboxed

All tasks on that priority level that aren't sandboxed would then still have to be run in sequence to avoid race conditions and the remaining subset parallelized on independent threads.

I'm currently on vacation, so I'll think on this some more once I return. Maybe I'll sketch something out on a separate branch. Thanks for the feature suggestion in the meantime :)

@kobaltcore
Copy link
Owner

Started some work on this over in feat/parallel-tasks. The initial prototype works, but I still need to think about the best way to expose this feature to reduce the amount of foot-guns to a minimum.

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

No branches or pull requests

2 participants