Runner¶
Runner.py: Task scheduling and execution
-
waflib.Runner.GAP= 10¶ Wait for free tasks if there are at least
GAP * njobsin queue
-
class
waflib.Runner.TaskConsumer[source]¶ Bases:
threading.ThreadTask consumers belong to a pool of workers
They wait for tasks in the queue and then use
task.process(...)-
ready= None¶ Obtain
waflib.Task.TaskBaseinstances from this queue.
-
loop()[source]¶ Obtain tasks from
waflib.Runner.TaskConsumer.readyand callwaflib.Task.TaskBase.process(). If the object is a function, execute it.
-
__doc__= '\n\tTask consumers belong to a pool of workers\n\n\tThey wait for tasks in the queue and then use ``task.process(...)``\n\t'¶
-
__module__= 'waflib.Runner'¶
-
-
waflib.Runner.pool= <Queue.Queue instance>¶ Pool of task consumer objects
-
waflib.Runner.get_pool()[source]¶ Obtain a task consumer from
waflib.Runner.pool. Do not forget to put it back by usingwaflib.Runner.put_pool()and reset properly (original waiting queue).Return type: waflib.Runner.TaskConsumer
-
waflib.Runner.put_pool(x)[source]¶ Return a task consumer to the thread pool
waflib.Runner.poolParameters: x ( waflib.Runner.TaskConsumer) – task consumer object
-
class
waflib.Runner.Parallel(bld, j=2)[source]¶ Bases:
objectSchedule the tasks obtained from the build context for execution.
-
__init__(bld, j=2)[source]¶ The initialization requires a build context reference for computing the total number of jobs.
-
numjobs= None¶ Number of consumers in the pool
-
bld= None¶ Instance of
waflib.Build.BuildContext
-
outstanding= None¶ List of
waflib.Task.TaskBasethat may be ready to be executed
-
frozen= None¶ List of
waflib.Task.TaskBasethat cannot be executed immediately
-
out= None¶ List of
waflib.Task.TaskBasereturned by the task consumers
-
count= None¶ Amount of tasks that may be processed by
waflib.Runner.TaskConsumer
-
processed= None¶ Amount of tasks processed
-
stop= None¶ Error flag to stop the build
-
error= None¶ Tasks that could not be executed
-
biter= None¶ Task iterator which must give groups of parallelizable tasks when calling
next()
-
__doc__= '\n\tSchedule the tasks obtained from the build context for execution.\n\t'¶
-
__module__= 'waflib.Runner'¶
-
dirty= None¶ Flag to indicate that tasks have been executed, and that the build cache must be saved (call
waflib.Build.BuildContext.store())
-
get_next_task()[source]¶ Obtain the next task to execute.
Return type: waflib.Task.TaskBase
-
postpone(tsk)[source]¶ A task cannot be executed at this point, put it in the list
waflib.Runner.Parallel.frozen.Parameters: tsk ( waflib.Task.TaskBase) – task
-
refill_task_list()[source]¶ Put the next group of tasks to execute in
waflib.Runner.Parallel.outstanding.
-
add_more_tasks(tsk)[source]¶ Tasks may be added dynamically during the build by binding them to the task
waflib.Task.TaskBase.more_tasksParameters: tsk ( waflib.Task.TaskBase) – task
-
get_out()[source]¶ 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
-
add_task(tsk)[source]¶ Pass a task to a consumer.
Parameters: tsk ( waflib.Task.TaskBase) – task
-
error_handler(tsk)[source]¶ Called when a task cannot be executed. The flag
waflib.Runner.Parallel.stopis set, unless the build is executed with:$ waf build -k
Parameters: tsk ( waflib.Task.TaskBase) – task
-
start()[source]¶ Give tasks to
waflib.Runner.TaskConsumerinstances until the build finishes or thestopflag is set. If only one job is used, then execute the tasks one by one, without consumers.
-