Package SCons :: Module Taskmaster :: Class Taskmaster
[show private | hide private]
[frames | no frames]

Class Taskmaster


The Taskmaster for walking the dependency DAG.


Method Summary
  __init__(self, targets, tasker, order, trace)
  find_next_candidate(self)
Returns the next candidate Node for (potential) evaluation.
  next_task(self)
Returns the next task to be executed.
  no_next_candidate(self)
Stops Taskmaster processing by not returning a next candidate.
  stop(self)
Stops the current build completely.
  _find_next_ready_node(self)
Finds the next node that is ready to be built.

Method Details

find_next_candidate(self)

Returns the next candidate Node for (potential) evaluation.

The candidate list (really a stack) initially consists of all of the top-level (command line) targets provided when the Taskmaster was initialized. While we walk the DAG, visiting Nodes, all the children that haven't finished processing get pushed on to the candidate list. Each child can then be popped and examined in turn for whether their children are all up-to-date, in which case a Task will be created for their actual evaluation and potential building.

Here is where we also allow candidate Nodes to alter the list of Nodes that should be examined. This is used, for example, when invoking SCons in a source directory. A source directory Node can return its corresponding build directory Node, essentially saying, "Hey, you really need to build this thing over here instead."

next_task(self)

Returns the next task to be executed.

This simply asks for the next Node to be evaluated, and then wraps it in the specific Task subclass with which we were initialized.

no_next_candidate(self)

Stops Taskmaster processing by not returning a next candidate.

stop(self)

Stops the current build completely.

_find_next_ready_node(self)

Finds the next node that is ready to be built.

This is the main guts of the DAG walk. We loop through the list of candidates, looking for something that has no un-built children (i.e., that is a leaf Node or has dependencies that are all leaf Nodes or up-to-date). Candidate Nodes are re-scanned (both the target Node itself and its sources, which are always scanned in the context of a given target) to discover implicit dependencies. A Node that must wait for some children to be built will be put back on the candidates list after the children have finished building. A Node that has been put back on the candidates list in this way may have itself (or its sources) re-scanned, in order to handle generated header files (e.g.) and the implicit dependencies therein.

Note that this method does not do any signature calculation or up-to-date check itself. All of that is handled by the Task class. This is purely concerned with the dependency graph walk.


Generated by Epydoc 2.1 on Wed Dec 12 09:39:32 2007 http://epydoc.sf.net