This module provide an implementation of a dataflow
-
exception core.dataflow.PortError[source]
Bases: exceptions.Exception
-
class core.dataflow.DataFlow[source]
Bases: openalea.core.graph.property_graph.PropertyGraph
Directed graph with connections between in_ports
of vertices and out_port of vertices
ports are typed
-
actor(vid)[source]
return actor associated to a given vertex
-
add_actor(actor, vid=None)[source]
create a vertex and the corresponding ports
and associate it with the given actor
return: vid
-
add_in_port(vid, local_pid, pid=None)[source]
add a new in port to vertex pid using local_pid
use pid as global port id if specified or
create a new one if None
raise an error if pid is already used
| Returns: | pid used |
| Return type: | pid |
-
add_out_port(vid, local_pid, pid=None)[source]
add a new out port to vertex pid using local_pid
use pid as global port id if specified or
create a new one if None
raise an error if pid is already used
| Returns: | pid used |
| Return type: | pid |
-
add_vertex(vid=None)[source]
add a vertex to the graph, if vid is not provided create a new vid
| Parameters: | vid (vid) -- the id of the vertex to add, default=None |
| Returns: | the id of the created vertex |
| Return type: | vid |
-
clear()[source]
remove all vertices and edges
don't change references to objects
-
connect(source_pid, target_pid, eid=None)[source]
connect the out port source_pid with
the in_port target_pid
use eid if not None or create a new one
raise an error if eid is already used
| Returns: | eid used |
| Return type: | eid |
-
connected_edges(pid)[source]
iterate on all edges connected
to this port
:rtype: iter of eid
-
connected_ports(pid)[source]
iterate on all ports connected
to this port
:rtype: iter of pid
-
get_all_parent_nodes(vid)[source]
Return an iterator of vextex id corresponding to all the
parent node of vid
-
in_port(vid, local_pid)[source]
global port id of a given port
:rtype: pid
-
in_ports(vid=None)[source]
iter on all in ports of a given vertex
iter on all in ports of the dataflow
if vid is None
-
is_in_port(pid)[source]
test whether port refered by pid
is an in port of its vertex
:rtype: bool
-
is_out_port(pid)[source]
test whether port refered by pid
is an out port of its vertex
:rtype: bool
-
local_id(pid)[source]
local port identifier of a given port
specified by its global pid
-
nb_connections(pid)[source]
Compute number of edges connected to a given port.
- args:
-
- return:
-
-
out_port(vid, local_pid)[source]
global port id of a given port
:rtype: pid
-
out_ports(vid=None)[source]
iter on all out ports of a given vertex
iter on all out ports of the dataflow
if vid is None
| Parameters: | vid -- todo |
| Return type: | iter of pid |
-
port(pid)[source]
port object specified by its global pid
-
ports(vid=None)[source]
iter on all ports of a given vertex
iter on all ports of the dataflow
if vid is None
-
remove_port(pid)[source]
remove the specified port
and all connections to this port
-
remove_vertex(vid)[source]
remove a specified vertex of the graph
remove all the edges attached to it
| Parameters: | vid (vid) -- the id of the vertex to remove |
-
set_actor(vid, actor)[source]
associate an actor to a given vertex
-
source_port(eid)[source]
out port of the source vertex
of the edge
| Parameters: | eid -- todo |
| Return type: | pid |
-
target_port(eid)[source]
in port of the target vertex
of the edge
| Parameters: | eid -- todo |
| Return type: | pid |
-
vertex(pid)[source]
return the id of the vertex which own the port
:rtype: vid
-
class core.dataflow.Port(vid, local_pid, is_out_port)[source]
Bases: object
simple structure to maintain some port property
a port is an entry point to a vertex
-
class core.dataflow.SubDataflow(dataflow, algo, node_id, port_index)[source]
Bases: object
Represents a part of a dataflow for a partial evaluation
A SubDataflow is a callable and absracts a part of a dataflow as a funtion