Package mrv :: Package automation :: Module workflow :: Class Workflow
[hide private]
[frames] | no frames]

Class Workflow

source code

                  object --+            
                           |            
networkx.classes.graph.Graph --+        
                               |        
networkx.classes.digraph.DiGraph --+    
                                   |    
                  object --+       |    
                           |       |    
         interface.Interface --+   |    
                               |   |    
         interface.iDuplicatable --+    
                                   |    
                           dge.Graph --+
                                       |
                                      Workflow
Known Subclasses:

Implements a workflow as connected processes

Note: if you have to access the processes directly, use the DiGraph methods

Nested Classes [hide private]
    Utility Classes
  ProcessData
Allows to store additional information with each process called during the workflow
  CallGraph
Simple wrapper storing a call graph, keeping the root at which the call started
Instance Methods [hide private]
 
__str__(self)
str(x)
source code
 
_populateFromGraph(self, graph)
Parse the networkx graph and populate ourselves with the respective process instances as described by the graph
source code

Inherited from networkx.classes.digraph.DiGraph: add_edge, add_edges_from, add_node, add_nodes_from, clear, degree_iter, edges_iter, has_predecessor, has_successor, in_degree, in_degree_iter, in_edges, in_edges_iter, is_directed, is_multigraph, neighbors, neighbors_iter, out_degree, out_degree_iter, out_edges, out_edges_iter, predecessors, predecessors_iter, remove_edge, remove_edges_from, remove_node, remove_nodes_from, reverse, subgraph, successors, successors_iter, to_directed, to_undirected

Inherited from networkx.classes.graph.Graph: __contains__, __getitem__, __iter__, __len__, add_cycle, add_path, add_star, add_weighted_edges_from, adjacency_iter, adjacency_list, copy, degree, edges, get_edge_data, has_edge, has_node, nbunch_iter, nodes_iter, nodes_with_selfloops, number_of_edges, number_of_nodes, number_of_selfloops, order, selfloop_edges, size

Inherited from interface.iDuplicatable: copyTo, copyToOther, duplicate

Inherited from interface.Interface: supports

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

    Main Interface
 
makeTarget(self, target)
Returns: result when producing the target
source code
 
makeTargets(self, targetList, errstream=None, donestream=None)
batch module compatible method allowing to make mutliple targets at once
source code
 
_evaluateDirtyState(self, outputplug, processmode)
Evaluate the given plug in process mode and return a dirty report tuple as used by makeDirtyReport
source code
 
makeDirtyReport(self, target, mode='single')
Returns: list of tuple( shell, DirtyReport|None ) If a process ( shell.node ) is dirty, a dirty report will be given explaining why the process is dirty and needs an update
source code
 
_clearState(self, global_evaluation_mode)
Clear the previous state and re-initialize this instance getting ready for a new instance
source code
 
_setupProcess(self, target, globalmode)
Setup the workflow's dg such that the returned output shell can be queried to evaluate target
source code
 
_evaluate(self, target, processmode, globalmode)
Make or update the target using a process in our workflow
source code
 
createReportInstance(self, reportType)
Create a report instance that describes how the previous target was made
source code
    Query
 
targetSupportList(self)
Returns: list of all supported target type
source code
 
targetRating(self, target)
Returns: int range(0,255) indicating how well a target can be made 0 means not at all, 255 means perfect.
source code
 
callgraph(self)
Returns: current callgraph instance
source code

Inherited from dge.Graph: hasNode, iterConnectedNodes, iterNodes, nodeByID, nodes, numNodes

    Internal Process Interface
 
_isDryRun(self)
Returns: True if the current computation is a dry run
source code
 
_trackOutputQueryStart(self, process, plug, mode)
Called by process base to indicate the start of a call of curProcess to targetProcess This method tracks the actual call path taken through the graph ( which is dependent on the dirty state of the prcoesses, allowing to walk it depth first to resolve the calls.
source code
 
_trackOutputQueryEnd(self, result=None)
Track that the process just finished its computation - thus the previously active process should be on top of the stack again
source code
    Overridden Object Methods
 
__init__(self, **kwargs)
Initalized base class
source code

Inherited from dge.Graph: __del__, __getattr__

    Debugging

Inherited from dge.Graph: writeDot

    iDuplicatable Interface
 
copyFrom(self, other)
Only mode is required
source code

Inherited from dge.Graph: createInstance

    Node Handling

Inherited from dge.Graph: addNode, clearCache, removeNode

    Connecitons

Inherited from dge.Graph: connect, disconnect, input, outputs

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 
Initalized base class
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

copyFrom(self, other)

source code 
Only mode is required
Overrides: interface.iDuplicatable.copyFrom

makeTarget(self, target)

source code 
Parameters:
  • target - target to make - can be class or instance
Returns:
result when producing the target

makeTargets(self, targetList, errstream=None, donestream=None)

source code 
batch module compatible method allowing to make mutliple targets at once
Parameters:
  • targetList - iterable providing the targets to make
  • errstream - object with file interface allowing to log errors that occurred during operation
  • donestream - if list, targets successfully done will be appended to it, if it is a stream, the string representation will be wrtten to it

makeDirtyReport(self, target, mode='single')

source code 
Parameters:
  • target - target you which to check for it's dirty state
  • mode -
    • single - only the process assigned to evaluate target will be checked

    • multi - as single, but the whole callgraph will be checked, starting

      at the first node, stepping down the callgraph. This gives a per node dirty report.

    • deep - try to evaluate target, but fail if one process in the target's

      call history is dirty

Returns:
list of tuple( shell, DirtyReport|None ) If a process ( shell.node ) is dirty, a dirty report will be given explaining why the process is dirty and needs an update

_clearState(self, global_evaluation_mode)

source code 
Clear the previous state and re-initialize this instance getting ready for a new instance
Parameters:
  • global_evaluation_mode - evaluation mode to be used

_setupProcess(self, target, globalmode)

source code 
Setup the workflow's dg such that the returned output shell can be queried to evaluate target
Parameters:
  • globalmode - mode with which all other processes will be handling their input calls

_evaluate(self, target, processmode, globalmode)

source code 
Make or update the target using a process in our workflow
Parameters:
  • processmode - the mode with which to call the initial process
Returns:
tuple( shell, result ) - plugshell queried to get the result

createReportInstance(self, reportType)

source code 
Create a report instance that describes how the previous target was made
Parameters:
  • reportType - Report to populate with information - it must be a Plan based class that can be instantiated and populated with call information. A report analyses the call dependency graph generated during dg evaluation and presents it.
Returns:
report instance whose makeReport method can be called to retrieve it

targetSupportList(self)

source code 
Returns:
list of all supported target type

Note: this method is for informational purposes only

targetRating(self, target)

source code 
Returns:

int range(0,255) indicating how well a target can be made 0 means not at all, 255 means perfect.

Return value is tuple ( rate, PlugShell ), containing the process and plug with the highest rating or None if rate is 0

Walk the dependency graph such that leaf nodes have higher ratings than non-leaf nodes

Note: you can use the process.ProcessBase enumeration for comparison

callgraph(self)

source code 
Returns:
current callgraph instance

Note: its strictly read-only and may not be changed

_isDryRun(self)

source code 
Returns:
True if the current computation is a dry run

_trackOutputQueryStart(self, process, plug, mode)

source code 
Called by process base to indicate the start of a call of curProcess to targetProcess This method tracks the actual call path taken through the graph ( which is dependent on the dirty state of the prcoesses, allowing to walk it depth first to resolve the calls. This also allows to create precise reports telling how to achieve a certain goal

_populateFromGraph(self, graph)

source code 
Parse the networkx graph and populate ourselves with the respective process instances as described by the graph
Parameters:
  • graph - networkx graph whose nodes are process names to be found in the processes module