Sequence management
The Entities' creation section provides documentation on Sequence
creation. Now
that we know how to create a new Sequence
, this section focuses on describing the sequence's attributes
and utility methods.
In this section, it is assumed that the my_config.py
module contains an already implemented configuration.
Sequence attributes¶
A sequence is identified by a unique identifier id
that Taipy generates. A sequence also holds
various properties accessible as an attribute of the sequence:
add data_nodes, parent_ids
- subscribers: The list of Tuples (callback, params) representing the subscribers.
- properties: The complete dictionary of the sequence properties. It includes a copy of the properties of the sequence configuration, in addition to the properties provided at the creation and runtime.
- tasks: The dictionary holds the sequence's various tasks. The key corresponds to the config_id of the task while the value is the task itself.
- data_nodes: The dictionary holding the various data nodes of the sequence. The key corresponds to the data node's config_id (while the value is the data node itself).
- owner_id: The identifier of the owner, which can be a scenario, cycle, or None.
- version: The string indicates the application version of the sequence to instantiate. If not provided, the current version is used. For more details, refer to version management.
- Each property of the properties dictionary is also directly exposed as an attribute.
- Each nested entity is also exposed as an attribute of the sequence. The attribute name corresponds to the config_id of the nested entity.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Get a sequence¶
There are two ways to retrieve a sequence:
The first method is by getting it from its parent scenario, using the sequence name as an attribute.
The second method to access a sequence is from its id using the taipy.get()
method.
1 2 3 4 5 6 7 8 |
|
Here the two variables sequence
and sequence_retrieved
are equal.
Get all sequences¶
All the sequences can be retrieved using the method taipy.get_sequences()
. This method returns the list of all
existing sequences.
Delete a sequence¶
A sequence can be deleted by using taipy.delete()
which takes the sequence id as a parameter. The deletion is
also propagated to the nested tasks, data nodes, and jobs if they are not shared with any other sequence.
Get parent scenarios¶
To get the parent entities of a sequence (i.e., scenarios) you can use either the method DataNode.get_parents()
or
the function
taipy.get_parents()
. Both return the parents of the sequence.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|