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

Concurrent/Parallel tasks #321

Closed
emigr2k1 opened this issue Nov 29, 2019 · 5 comments
Closed

Concurrent/Parallel tasks #321

emigr2k1 opened this issue Nov 29, 2019 · 5 comments
Assignees
Milestone

Comments

@emigr2k1
Copy link

Features Description
This feature would allow to run a parent task that executes other children tasks parallelly. The parent task would only finish after all children tasks have finished.

Describe the solution you'd like
If I have something like

[task.build-sass]
command = ["sass"]
args = ["scss/:css/"]

[task.build-ts]
command = ["ts"]
args = ["./ts", "-o", "./js"]

[tasks.build]
run_task = [
    { name = "build-ts", parallel = true },
    { name = "build-sass", parallel = true },
]

then I run cargo make build, it should execute build-ts and build-sass parallelly.

There is a problem with the output of both tasks because they would be interlapping. This could be fixed by buffering the output of each task and only write it to stdout when the task finishes. Stderr output could be written directly, maybe. I didn't think much about this.

@sagiegurari
Copy link
Owner

thanks, its a really good idea.
i was thinking about it a while back but figured no one would use it so definitely want this to happen.
i was also thinking about the output but there i think we shouldn't buffer.
the result would be a big mess but reason is that there are scripts/cimmands that you invoke that might pause and wait for user input (fir example if you install something with sudo, it will pause for a password).
will definitely check it out.

@sagiegurari
Copy link
Owner

@emigr2k1 I just pushed a commit with the parallel support.
You can read the docs and checkout the parallel flag on how to use it.
if you can try it out and provide some feedback, that would be great.

Simple example:

[tasks.echo1]
command = "echo"
args = ["1"]

[tasks.echo2]
command = "echo"
args = ["2"]

[tasks.parallel-multi]
run_task = { name = ["echo1", "echo2"], parallel = true }

@emigr2k1
Copy link
Author

emigr2k1 commented Dec 1, 2019

@sagiegurari Wow! That was quick.
I just tried it and it's working fine so far. I'll let you know if I have anything else to say.
Thank you!
Should this issue be closed?

@sagiegurari
Copy link
Owner

no need to close. i usually close when i officially release it

@sagiegurari
Copy link
Owner

This is now officially release so i'm closing this issue.

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