Runner.py: Task scheduling and execution
Wait for free tasks if there are at least GAP * njobs in queue
Bases: threading.Thread
Task consumers belong to a pool of workers
They wait for tasks in the queue and then use task.process(...)
Obtain waflib.Task.TaskBase instances from this queue.
Obtain tasks from waflib.Runner.TaskConsumer.ready and call waflib.Task.TaskBase.process(). If the object is a function, execute it.
Pool of task consumer objects
Obtain a task consumer from waflib.Runner.pool. Do not forget to put it back by using waflib.Runner.put_pool() and reset properly (original waiting queue).
Return type: | waflib.Runner.TaskConsumer |
---|
Return a task consumer to the thread pool waflib.Runner.pool
Parameters: | x (waflib.Runner.TaskConsumer) – task consumer object |
---|
Bases: object
Schedule the tasks obtained from the build context for execution.
The initialization requires a build context reference for computing the total number of jobs.
Number of consumers in the pool
Instance of waflib.Build.BuildContext
List of waflib.Task.TaskBase that may be ready to be executed
List of waflib.Task.TaskBase that cannot be executed immediately
List of waflib.Task.TaskBase returned by the task consumers
Amount of tasks that may be processed by waflib.Runner.TaskConsumer
Amount of tasks processed
Error flag to stop the build
Tasks that could not be executed
Task iterator which must give groups of parallelizable tasks when calling next()
Flag to indicate that tasks have been executed, and that the build cache must be saved (call waflib.Build.BuildContext.store())
Obtain the next task to execute.
Return type: | waflib.Task.TaskBase |
---|
A task cannot be executed at this point, put it in the list waflib.Runner.Parallel.frozen.
Parameters: | tsk (waflib.Task.TaskBase) – task |
---|
Put the next group of tasks to execute in waflib.Runner.Parallel.outstanding.
Tasks may be added dynamically during the build by binding them to the task waflib.Task.TaskBase.more_tasks
Parameters: | tsk (waflib.Task.TaskBase) – task |
---|
Obtain one task returned from the task consumers, and update the task count. Add more tasks if necessary through waflib.Runner.Parallel.add_more_tasks.
Return type: | waflib.Task.TaskBase |
---|
Called when a task cannot be executed. The flag waflib.Runner.Parallel.stop is set, unless the build is executed with:
$ waf build -k
Parameters: | tsk (waflib.Task.TaskBase) – task |
---|
Pass a task to a consumer.
Parameters: | tsk (waflib.Task.TaskBase) – task |
---|
Give tasks to waflib.Runner.TaskConsumer instances until the build finishes or the stop flag is set. If only one job is used, then execute the tasks one by one, without consumers.