1

I am using Waf to automate the building process of my project.

The problem is that I have two kinds of parallelization. The first one is by using a switch for the job number meaning parallel processes when running Waf on the command line.

$ python waf.py build -j4

The second kind of parallelization happens in some scripts which are executed by Waf and which cannot be rewritten to use Waf's parallelization.

To keep the amount of threads used stable, I have to interrupt the build process and change the job switch. Is there a way to do this dynamically so that I can specify for a certain folder that tasks are run using 5 threads or something else?

Thanks for your help!

tobiasraabe
  • 427
  • 1
  • 6
  • 12
  • Have a look at the [`Spawner`](https://github.com/waf-project/waf/blob/d21446ff7152a18f563a947e483b63ace91e794d/waflib/Runner.py#L74) and [`Consumer`](https://github.com/waf-project/waf/blob/d21446ff7152a18f563a947e483b63ace91e794d/waflib/Runner.py#L47). Maybe you can monkey patch those to do what you want. – mandrake Mar 08 '18 at 17:04
  • @mandrake: Looks like waf is on gitlab now: https://gitlab.com/ita1024/waf/ – genpfault May 17 '22 at 18:02

1 Answers1

0

You can do that by specializing the runnable_status of a task. There is an example in waf playground which you can use to limit the number of link tasks to MAX (1 by default) at a time. I've generalized it to limit to N tasks tagged with a label.

neuro
  • 14,948
  • 3
  • 36
  • 59