nuke icon indicating copy to clipboard operation
nuke copied to clipboard

Parallel execution of targets

Open matkoch opened this issue 6 years ago • 17 comments

matkoch avatar Oct 30 '18 10:10 matkoch

I see a ton of value in this and would like to help move it along if possible. I haven't dug into the code around target execution much yet, as I'm sure you have some thoughts on this already. I assume https://github.com/nuke-build/common/tree/feature/parallel2 has the latest WIP for this.

As far as the user-facing side of this, to me the minimum requirement would be:

  • Allowing the user to opt in to parallel target execution. This could be via parameter, overridden NukeBuild property (could also simply be overriding the default parameter value), and/or environment variable.

Some things I could see users maybe wanting to do:

  • Mark specific targets to not be parallelized (CPU-heavy, prone to async issues, or just user preference).
  • Configure the max number of parallel targets.

Aside from setting up the execution plan and actually invoking targets in parallel, a couple interesting challenges might be:

  • Logging/IO - printing output from async logs in a readable manner (e.g., buffered and flushed per-target for standard console, printed in realtime with flowId when running in TeamCity, etc.)
  • Target execution times - I don't know how precise this feasibly can or should be, but showing the actual times spent executing each target—i.e., excluding any time an async task spends waiting for a thread on which to continue. Maybe this isn't really an issue depending on the number of parallel tasks.

If you have any suggestions on where I can pitch in or pick up on work, please let me know! I have limited time to spend on this every couple weeks, but it seems like a fun problem and I think it would be very beneficial feature to have.

lshearer avatar Jul 31 '19 00:07 lshearer

Allowing the user to opt in to parallel target execution. This could be via parameter, overridden NukeBuild property (could also simply be overriding the default parameter value), and/or environment variable.

Agreed. Parameters are already aware of environment variables.

Mark specific targets to not be parallelized (CPU-heavy, prone to async issues, or just user preference).

This would be solely defined via the dependency model. If two targets do not depend on each other (execution/order/trigger dependency), they can run in parallel.

Configure the max number of parallel targets.

Not needed imo.

Logging/IO - printing output from async logs in a readable manner (e.g., buffered and flushed per-target for standard console, printed in realtime with flowId when running in TeamCity, etc.)

Flow ids would be the easiest for a start. My preferred option would be to flush only when a target has finished. https://github.com/nuke-build/nuke/issues/107 would be great for that too, to show some kind of progress.

Target execution times - I don't know how precise this feasibly can or should be, but showing the actual times spent executing each target—i.e., excluding any time an async task spends waiting for a thread on which to continue. Maybe this isn't really an issue depending on the number of parallel tasks.

I wouldn't change anything around that. Let's wait for an actual request.

The first next step would be to create a appropriate data structure from which we can tell which targets can be run in parallel. I've stubbed some classes for that in https://github.com/nuke-build/common/commit/b7b836643af0ea37454b37bb32c132fadc855cbd#diff-8c68ce1c46e703ab9fd73f4d53581127R224. However, I've never really managed to invest some time implementing the Compose method https://github.com/nuke-build/common/commit/b7b836643af0ea37454b37bb32c132fadc855cbd#diff-8c68ce1c46e703ab9fd73f4d53581127R27.

matkoch avatar Jul 31 '19 10:07 matkoch

@lshearer any findings/progress?

matkoch avatar Sep 16 '19 12:09 matkoch

@matkoch I see 500 stars and still no parallel execution?!

https://nukebuildnet.slack.com/archives/C9Q99MFU0/p1550410859094700

RLittlesII avatar Nov 14 '19 20:11 RLittlesII

/kickban

matkoch avatar Nov 14 '19 20:11 matkoch

Is this still something that is planned to be included? I can see a PR exist for this functionality. This would be utterly amazing to have included 😄

Baune8D avatar Jun 23 '21 18:06 Baune8D

I see a PR but aside from @matkoch keeping it up to date with develop nothing seems to be happening there? I assume this means its still a planned feature but something is blocking this. Is there any help needed in completing this?

Barsonax avatar Feb 07 '22 13:02 Barsonax

Hi @matkoch, what's happening with this feature? Is there a plan to release it soon?

Jarryd460 avatar Mar 09 '22 13:03 Jarryd460

There are no plans

matkoch avatar Mar 09 '22 13:03 matkoch

Anything the community can do to assist to get this over the line?

matt-psaltis avatar Sep 25 '22 07:09 matt-psaltis

@matt-psaltis not really

matkoch avatar Sep 25 '22 14:09 matkoch

Would it be possible to get a little bit more information about this please? The PR is still being kept up to date but no plans to merge and release. Just helps to avoid confusion for the community. Kind regards!

matt-psaltis avatar Sep 26 '22 01:09 matt-psaltis

Not sure why this is confusing. I already mentioned that I have no plans and that there's nothing the community can help with. I also don't know anything about a branch being kept up-to-date. Where does that come from?

matkoch avatar Sep 26 '22 05:09 matkoch

Hi @matkoch the branch and open PR can be found here: https://github.com/nuke-build/nuke/pull/526

It looked like the PR has had a bunch of commits to it recently, keeping it up to date with develop. From my naïve perspective, it looked like community members had submitted a contribution and it was a potential candidate for the community to help with to get this feature across the line. Thanks for your time and responses.

matt-psaltis avatar Sep 26 '22 06:09 matt-psaltis

He might be referring to my comment but that comment is now 8 months old.

A bummer this is not going to make it in NUKE though. Would be a killer feature as that really would put NUKE even further ahead compared to other build automation tools.

Barsonax avatar Sep 26 '22 06:09 Barsonax

I would love to see this feature in Nuke, because at the moment we still have to depend on a particular provider to build more complex pipelines and leverage parallelism

albertocorrales avatar Dec 21 '23 14:12 albertocorrales

I would love to see this feature in Nuke, because at the moment we still have to depend on a particular provider to build more complex pipelines and leverage parallelism

We have Cake scripts. I was looking into Cake and Nuke for a long time to introduce parallelism... To none result.

That is why I'm looking into Bullseye which can parallelize tasks.

Writing everything in the C# script and just running it on any platform with one command is I think better than making complex pipelines within that platform.

That is what I learned after this. :D Btw, handling artifacts between jobs (which runs in dockers) is the worst! image

jakubsuchybio avatar Dec 24 '23 14:12 jakubsuchybio