Epydoc: mrv.automation.process
Contains base class and common methods for all processes
Returns: | A path instance of the correct type |
---|---|
Note: | use this constructor if you use the Path.set_separator method at runtime to assure you will always create instances of the actual type, and not only of the type you imported last |
Epydoc: mrv.automation.process
Bases: object
Simple class defining the type of a plug and several flags that affect it. Additionally it can determine how well suited another attribute is
Nodes are automatically computable if they are affected by another plug. If this is not the case, they are marked input only and are not computed. If this flag is true, even unaffeted plugs are computable. Plugs that affect something are automatically input plugs and will not be computed. If the plug does not affect anything and this flag is False, they are seen as input plugs anyway.
The system does not allow plugs to be input and output plugs at the same time, thus your compute cannot be triggered by your own compute
cls: if True, the plug requires classes to be set ( instances of ‘type’ ) , but no instances of these classes uncached: if False, computed values may be cached, otherwise they will always be recomputed. unconnectable: if True, the node cannot be the destination of a connection check_passing_values: check each value as it flows through a connection - usually compatability is only checked on connection and once values are set, but not if they flow through an existing connection
Compute affinity for otherattr.
Returns: | rating from 0 to 255 defining how good the attribtues match each other in general - how good can we store values of otherattr ? Thus this comparison is directed. |
---|---|
Note: | for checking connections, use connectionAffinity |
Compute value’s compatability rate
Returns: | value between 0 and 255, 0 means no compatability, 255 a perfect match. if larger than 0, the plug can hold the value ( assumed the flags are set correctly ). |
---|
Compute connection affinity for given destination attribute
Returns: | rating from 0 to 255 defining the quality of the connection to otherplug. an affinity of 0 mean connection is not possible, 255 mean the connection is perfectly suited. The connection is a directed one from self -> otherplug |
---|
Returns: | default value stored for this attribute, or raise |
---|---|
Note: | handles dynamic defaults, so you should not directly access the default member variable |
Raises MissingDefaultValueError: | |
if attribute does not have a default value | |
Raises TypeError: | |
if value returned by dynamic attribute has incorrect type |
Epydoc: mrv.automation.process
Bases: mrv.dgfe.FacadeNodeBase
A node wrapping a graph, allowing it to be nested within the node All inputs and outputs on this node are purely virtual, thus they internally connect to the wrapped graph.
Todo: | tests deletion of graphnodes and see whether they are being garbage collected. It should work with the new collector as it can handle cyclic references - these strong cycles we have a lot in this structure. Weakrefs will not work for nested facade nodes as they are tuples not allowing weak refs. |
---|
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | list of intermediate children of path, [ child1 , child2 ] |
---|---|
Parameter: | predicate – return True to include x in result |
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
if a cache has been build as caching is enabled, this method clears the cache forcing it to be updated on the next demand
Note: | this could be more efficient by just deleting plugs that are not required anymore, but probably this method can expect the whole cache to be deleted right away ... so its fine |
---|
Called whenever a plug needs computation as the value its value is not cached or marked dirty ( as one of the inputs changed )
Parameters: |
|
---|---|
Note: | to be implemented by superclass |
Returns: | Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell ) |
---|---|
Parameters: |
|
Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance
Returns: | altered instance |
---|---|
Note: | instance will be altered during the process |
Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class
Parameters: |
|
---|
Returns: | sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned. |
---|---|
Parameters: |
|
Raises TypeError: | |
if ambiguous input was found |
Returns: | ID of this instance |
---|
Returns: | list of plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | list of plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | list of static plugs as defined on this node - they are class members |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Note: | Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one. |
Returns: | the root of the DAG - it has no further parents |
---|
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Returns: | a plugshell as suitable to for this class |
---|
Returns: | list of shells made from plugs and our node |
---|
Epydoc: mrv.automation.process
Bases: mrv.interface.iDuplicatable
Base class that provides support for plugs to the superclass. It will create some simple tracking attriubtes required for the plug system to work
Nodes can compute values of their plugs if these do not have a cache.
Nodes are identified by an ID - the default graph implementation though will be okay with just having instances. It is also being used for string representations of this node
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | list of intermediate children of path, [ child1 , child2 ] |
---|---|
Parameter: | predicate – return True to include x in result |
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Called whenever a plug needs computation as the value its value is not cached or marked dirty ( as one of the inputs changed )
Parameters: |
|
---|---|
Note: | to be implemented by superclass |
Returns: | Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell ) |
---|---|
Parameters: |
|
Just take the graph from other, but do not ( never ) duplicate it
Parameter: | add_to_graph – if true, the new node instance will be added to the graph of |
---|---|
Note: | default implementation does not copy plug caches ( which are stored in the node dict - this is because a reevaluate is usually required on the duplicated node |
Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance
Returns: | altered instance |
---|---|
Note: | instance will be altered during the process |
Create a copy of self and return it
Note: | override by subclass - the __init__ methods shuld do the rest |
---|
Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class
Parameters: |
|
---|
Returns: | sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned. |
---|---|
Parameters: |
|
Raises TypeError: | |
if ambiguous input was found |
Returns: | ID of this instance |
---|
Returns: | list of plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | list of plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | list of dynamic plugs as defined on this node - they are usually retrieved on class level, but may be overridden on instance level |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Returns: | list of static plugs as defined on this node - they are class members |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Note: | Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one. |
Returns: | the root of the DAG - it has no further parents |
---|
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Returns: | a plugshell as suitable to for this class |
---|
Returns: | list of shells made from plugs and our node |
---|
Epydoc: mrv.automation.process
Bases: object
For use with python’s filter method, simulates logical OR Usage: filter(Or(f1,f2,fn), sequence)
Epydoc: mrv.automation.process.ProcessBase
Bases: mrv.dge.NodeBase
The base class for all processes, defining a common interface Inputs and Outputs of this node are statically described using plugs
Note: | the process base is able to duplcate properly as it stores in constructor arguments accordingly |
---|
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | list of intermediate children of path, [ child1 , child2 ] |
---|---|
Parameter: | predicate – return True to include x in result |
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell ) |
---|---|
Parameters: |
|
Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance
Returns: | altered instance |
---|---|
Note: | instance will be altered during the process |
Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class
Parameters: |
|
---|
Returns: | an instance suitable to be stored in the given plug |
---|---|
Parameters: |
|
Note: | needs to be implemented by subclasses, but subclasses can just call their superclass for all unhandled plugs resulting in consistent error messages |
Returns: | sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned. |
---|---|
Parameters: |
|
Raises TypeError: | |
if ambiguous input was found |
Returns: | ID of this instance |
---|
Returns: | list of plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | list of plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | list of dynamic plugs as defined on this node - they are usually retrieved on class level, but may be overridden on instance level |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Returns: | list of static plugs as defined on this node - they are class members |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Note: | Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one. |
Returns: | the root of the DAG - it has no further parents |
---|
Returns: | list target types that can be output |
---|---|
Note: | targetTypes are classes, not instances |
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Returns: | tuple( int, PlugShell ) int between 0 and 255 - 255 means target matches perfectly, 0 means complete incompatability. Any inbetweens indicate the target can be achieved, but maybe just in a basic way If rate is 0, the object will be None, otherwise its a plugShell to the input attribute that can take target as input. In process terms this means that at least one output plug exists that produces the target. |
---|---|
Parameters: |
|
Raises TypeError: | |
if the result is ambiguous and raise_on_ambiguity = 1 |
Returns: | a plugshell as suitable to for this class |
---|
Returns: | list of shells made from plugs and our node |
---|
Returns: | the workflow instance we are connected with. Its used to query global data |
---|
Epydoc: mrv.automation.process.WorkflowProcessBase
Bases: mrv.dgfe.GraphNodeBase, mrv.automation.process.ProcessBase
A process wrapping a workflow, allowing workflows to be nested Derive from this class and initialize it with the workflow you would like to have wrapped The process works by transmitting relevant calls to its underlying workflow, allowing nodeInsideNestedWorkflow -> thisworkflow.node.plug connections
Workflows are standin nodes - they can connect anything their wrapped nodes can connect
Note: | to prevent dependency issues, the workflow instance will be bound on first use |
---|
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | list of intermediate children of path, [ child1 , child2 ] |
---|---|
Parameter: | predicate – return True to include x in result |
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
if a cache has been build as caching is enabled, this method clears the cache forcing it to be updated on the next demand
Note: | this could be more efficient by just deleting plugs that are not required anymore, but probably this method can expect the whole cache to be deleted right away ... so its fine |
---|
Returns: | Tuples of input shells defining a connection of the given type from tuple( InputNodeOuptutShell, OurNodeInputShell ) for input connections and tuple( OurNodeOuptutShell, OutputNodeInputShell ) |
---|---|
Parameters: |
|
Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance
Returns: | altered instance |
---|---|
Note: | instance will be altered during the process |
Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class
Parameters: |
|
---|
Returns: | an instance suitable to be stored in the given plug |
---|---|
Parameters: |
|
Note: | needs to be implemented by subclasses, but subclasses can just call their superclass for all unhandled plugs resulting in consistent error messages |
Returns: | sorted list of (rate,plug) tuples suitable to deal with the given attribute. Thus they could connect to it as well as get their value set. Most suitable plug comes first. Incompatible plugs will be pruned. |
---|---|
Parameters: |
|
Raises TypeError: | |
if ambiguous input was found |
Returns: | ID of this instance |
---|
Returns: | list of plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable as input |
---|---|
Note: | convenience method |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | list of plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | list of static plugs suitable to deliver output |
---|---|
Note: | convenience method |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | list of static plugs as defined on this node - they are class members |
---|---|
Parameter: | predicate – return static plug only if predicate is true |
Note: | Use this method only if you do not have an instance - there are nodes that actually have no static plug information, but will dynamically generate them. For this to work, they need an instance - thus the plugs method is an instance method and is meant to be the most commonly used one. |
As we have different callgraphs, but want proper reports, just swap in the callgraph of our own workflow to allow it to be maintained correctly when the nodes of the wrapped graph evaluate.
Note: | this requires that we get called after the callgraph has bene initialized |
---|
Returns: | the root of the DAG - it has no further parents |
---|
Returns: | list target types that can be output |
---|---|
Note: | targetTypes are classes, not instances |
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Returns: | tuple( int, PlugShell ) int between 0 and 255 - 255 means target matches perfectly, 0 means complete incompatability. Any inbetweens indicate the target can be achieved, but maybe just in a basic way If rate is 0, the object will be None, otherwise its a plugShell to the input attribute that can take target as input. In process terms this means that at least one output plug exists that produces the target. |
---|---|
Parameters: |
|
Raises TypeError: | |
if the result is ambiguous and raise_on_ambiguity = 1 |
Returns: | a plugshell as suitable to for this class |
---|
Returns: | list of shells made from plugs and our node |
---|
Returns: | the workflow instance we are connected with. Its used to query global data |
---|