ryvencore.FlowExecutor module - ryvencore v0.1.0 documentation

Hide navigation sidebar
Hide table of contents sidebar
Toggle table of contents sidebar

# ryvencore.FlowExecutor module

While standard flow execution (data-flow or exec-flow) is implemented inside the classes (like Node), this module provides special FlowExecutors which take over most of the work and implement more sophisticated and optimized flow execution.

class FlowExecutor(flow)

  Bases: `object`

  Base class for special flow execution algorithms.

  update_node(node, inp)
  input(node, index)
  set_output_val(node, index, val)
  exec_output(node, index)

class DataFlowOptimized(flow)

  Bases: `ryvencore.FlowExecutor.FlowExecutor`

  A special flow executor which implements some node functions to optimise flow execution. Whenever a new execution is invoked somewhere (some node or output is updated), it analyses the graph’s connected component (of successors) where the execution was invoked and creates a few data structures to reverse engineer how many input updates every node possibly receives in this execution. A node’s outputs are propagated once no input can still receive new data from a predecessor node. Therefore, while a node gets updated every time an input receives some data, every OUTPUT is only updated ONCE. This implies that every connection is activated at most once in an execution. This can result in asymptotic speedup in large data flows compared to normal data flow execution where any two executed branches which merge again in the future result in two complete executions of everything that comes after the merge, which quickly produces exponential performance issues.

  update_node(node, inp=- 1)
  input(node, index)
  set_output_val(node, index, val)
  exec_output(node, index)
  start_execution(root_node=None, root_output=None)
  stop_execution()
  generate_waiting_count(root_node=None, root_output=None)
  invoke_node_update_event(node, inp)
  decrease_wait(node)

    decreases the wait count of the node; if the count reaches zero, which means there is no other input waiting for data, the output values get propagated

  propagate_outputs(node)

    propagates all outputs of node

  propagate_output(out)

    pushes an output’s value to successors if it has been changed in the execution