seq  4.0.0-pre3
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lib.nodes.loop.Loop Class Reference

Loop node definition. More...

Inheritance diagram for lib.nodes.loop.Loop:
lib.nodes.sequence.Sequence lib.nodes.interface._BaseNode lib.nodes.recover.RLoop

Public Member Functions

def __attrs_post_init__ (self)
 Assigns node's name and id. More...
 
def end_step (self)
 Standard Loop's end step. More...
 
def make_sequence (self, parent_tpl=None)
 Creates the Loop execution graph. More...
 
def set_block (self, *args)
 Assigns the sequence to the loop's block. More...
 
def make_task (self, node, input_list, resume)
 Creates the task object that executes the node. More...
 
def nodes (self)
 Return nodes from Graph. More...
 
def get_node (self, node_id)
 Get node by id. More...
 
- Public Member Functions inherited from lib.nodes.sequence.Sequence
def __iter__ (self)
 
def start_step (self)
 Standard sequence's start step. More...
 
def append (self, s)
 Appends a node to the Sequence. More...
 
def create_node_tasks (self, resume=False)
 Creates Task object associated to this node. More...
 
def reschedule_node (self, node_id)
 Reschedule a node for execution. More...
 
def start (self, make_sequence=True, resume=False)
 This is the entry point for Sequence execution. More...
 
def run (self)
 Runs the node – This executes the task. More...
 
def execute (self, resume=False, propagate=False)
 Executes this just creates the asyncio task. More...
 
def resume (self)
 Resume node execution. More...
 
def main_task (self)
 Returns the objective node of the sequence – the end node. More...
 
def __call__ (self, resume=False)
 
def abort (self)
 Aborts the sequence. More...
 
def get_task (self, node_id)
 Get task by node_id. More...
 
def par (self, k)
 Get a parameter value. More...
 
def set (self, p)
 Sets the value of a parameter. More...
 
- Public Member Functions inherited from lib.nodes.interface._BaseNode
def make_sequence (self)
 does nothing More...
 
def pause (self)
 

Static Public Member Functions

def create (*args, **kw)
 Creates a :class:Loop node. More...
 
- Static Public Member Functions inherited from lib.nodes.sequence.Sequence
def get_context ()
 

Public Attributes

 name
 
 state
 
 in_error
 
 runtime_flags
 
- Public Attributes inherited from lib.nodes.sequence.Sequence
 name
 
 id
 
 in_error
 
 runtime_flags
 
 t_start
 
 skip
 
 exception
 
 t_end
 

Static Public Attributes

 block_args = attr.ib(kw_only=True, default=attr.Factory(list), repr=False)
 
 condition = attr.ib(kw_only=True, default=None, repr=False)
 
 init = attr.ib(kw_only=True, default=None, repr=False)
 
 block = attr.ib(init=False, default=None, repr=False)
 
 node_value = attr.ib(init=False, default=0, repr=False)
 
 parent_tpl = attr.ib(default=None, repr=False)
 
 index = cv.ContextVar("index", default=0)
 
- Static Public Attributes inherited from lib.nodes.sequence.Sequence
 graph = attr.ib(init=False, default=attr.Factory(nx.DiGraph), repr=False)
 
 debug = attr.ib(init=False, default=False, repr=False)
 
 current_seq = cv.ContextVar("current_seq", default=None)
 
 root = cv.ContextVar("root", default=None)
 
- Static Public Attributes inherited from lib.nodes.interface._BaseNode
 id = attr.ib(default=None, kw_only=True)
 
 name = attr.ib(default=None, kw_only=True)
 
 runtime_flags = attr.ib(default=0, kw_only=True)
 
 deps = attr.ib(default=attr.Factory(list), repr=False, kw_only=True, init=False)
 
 description = attr.ib(default="", kw_only=True)
 
 exception = attr.ib(init=False, default=None, repr=False)
 
 can_skip = attr.ib(default=True, init=False)
 
 hide = attr.ib(default=False, init=False)
 
 t_start = attr.ib(init=False, default=None, repr=False)
 
 t_end = attr.ib(init=False, default=None, repr=False)
 
 running_checkpoint
 
 serial_number = attr.ib(init=False)
 

Additional Inherited Members

- Properties inherited from lib.nodes.sequence.Sequence
 context = property
 Get context dictionary, preferably from root node. More...
 
 seq = property
 Retrieves the sequence list. More...
 
 G = property
 returns the graph object More...
 
 start_node = property
 Returns the start node. More...
 
 end_node = property
 Returns the end node. More...
 
 parameters = property
 Return parameters. More...
 
 state = property
 node state More...
 
 full_state = property
 
- Properties inherited from lib.nodes.interface._BaseNode
 result = property
 Node's result. More...
 
 end_node = property
 
 start_node = property
 
 state = property
 Gets the node state. More...
 
 full_state = property
 Gets the node state. More...
 
 in_error = property
 
 skip = property
 

Detailed Description

Loop node definition.

Use the :meth:create method to build properly :class:Loop node. Since it inherits from :class:Sequence it has access to the same context variables.

Table 1

Context Variables

Name Desc
current_seq The parent of the current node (from :class:Sequence)
root Top level DAG's root (from :class:Sequence)
index The Loop's current index (starts at 0)
- -
    id (Optional str): Node id.
    name (Optional str): Node name.
Parameters
initInitialization node.
conditionA Python method that returns a boolean value.
blockThe loop's body.

Member Function Documentation

◆ __attrs_post_init__()

def lib.nodes.loop.Loop.__attrs_post_init__ (   self)

Assigns node's name and id.

Reimplemented from lib.nodes.sequence.Sequence.

Reimplemented in lib.nodes.recover.RLoop.

◆ create()

def lib.nodes.loop.Loop.create ( args,
**  kw 
)
static

Creates a :class:Loop node.

         *args: Variable length list of nodes or coroutines that comprises the Loop`s body.
Parameters
idNode id
namenode name
initinitialization node :class:Action or :class:ActionInThread.
conditioncondition node :class:Action or :class:ActionInThread.
Returns
A new :class:Loop object

Examples

Creating a loop.

.. code-block:: python

def eval_condition():
    return False

class Tpl:
    def initialize(self, context):
# performs some initialization
pass

async def a(): pass async def b():

Returns
pass
            @staticmethod
            def create()
t = MyClass()
l = Loop.create(t.a, t.b, condition=eval_condition, init=t.initialize)

Reimplemented from lib.nodes.sequence.Sequence.

◆ end_step()

def lib.nodes.loop.Loop.end_step (   self)

Standard Loop's end step.

Evaluates the Loop's final state.

Reimplemented from lib.nodes.sequence.Sequence.

◆ get_node()

def lib.nodes.loop.Loop.get_node (   self,
  node_id 
)

Get node by id.

Reimplemented from lib.nodes.sequence.Sequence.

◆ make_sequence()

def lib.nodes.loop.Loop.make_sequence (   self,
  parent_tpl = None 
)

Creates the Loop execution graph.

Reimplemented from lib.nodes.sequence.Sequence.

◆ make_task()

def lib.nodes.loop.Loop.make_task (   self,
  node,
  input_list,
  resume 
)

Creates the task object that executes the node.

Reimplemented from lib.nodes.interface._BaseNode.

Reimplemented in lib.nodes.recover.RLoop.

◆ nodes()

def lib.nodes.loop.Loop.nodes (   self)

Return nodes from Graph.

Reimplemented from lib.nodes.sequence.Sequence.

◆ set_block()

def lib.nodes.loop.Loop.set_block (   self,
args 
)

Assigns the sequence to the loop's block.

Member Data Documentation

◆ block

lib.nodes.loop.Loop.block = attr.ib(init=False, default=None, repr=False)
static

◆ block_args

lib.nodes.loop.Loop.block_args = attr.ib(kw_only=True, default=attr.Factory(list), repr=False)
static

◆ condition

lib.nodes.loop.Loop.condition = attr.ib(kw_only=True, default=None, repr=False)
static

◆ in_error

lib.nodes.loop.Loop.in_error

◆ index

lib.nodes.loop.Loop.index = cv.ContextVar("index", default=0)
static

◆ init

lib.nodes.loop.Loop.init = attr.ib(kw_only=True, default=None, repr=False)
static

◆ name

lib.nodes.loop.Loop.name

◆ node_value

lib.nodes.loop.Loop.node_value = attr.ib(init=False, default=0, repr=False)
static

◆ parent_tpl

lib.nodes.loop.Loop.parent_tpl = attr.ib(default=None, repr=False)
static

◆ runtime_flags

lib.nodes.loop.Loop.runtime_flags

◆ state

lib.nodes.loop.Loop.state

The documentation for this class was generated from the following file: