Skip to content

taipy.core.Task

Bases: _Entity, _Labeled

Hold a user function that will be executed, its parameters and the results.

A Task brings together the user code as function, the inputs and the outputs as data nodes (instances of the DataNode class).

Attributes:

Name Type Description
config_id str

The identifier of the TaskConfig.

properties dict[str, Any]

A dictionary of additional properties.

function callable

The python function to execute. The function must take as parameter the data referenced by inputs data nodes, and must return the data referenced by outputs data nodes.

input Union[DataNode, List[DataNode]]

The list of inputs.

output Union[DataNode, List[DataNode]]

The list of outputs.

id str

The unique identifier of the task.

owner_id str

The identifier of the owner (sequence_id, scenario_id, cycle_id) or None.

parent_ids Optional[Set[str]]

The set of identifiers of the parent sequences.

version str

The string indicates the application version of the task to instantiate. If not provided, the latest version is used.

skippable bool

If True, indicates that the task can be skipped if no change has been made on inputs. The default value is False.

scope: Scope property

Retrieve the lowest scope of the task based on its data nodes.

Returns:

Type Description
Scope

The lowest scope present in input and output data nodes or GLOBAL if there are either no input or no output.

get_label()

Returns the task simple label prefixed by its owner label.

Returns:

Type Description
str

The label of the task as a string.

get_parents()

Get parents of the task.

get_simple_label()

Returns the task simple label.

Returns:

Type Description
str

The simple label of the task as a string.

submit(callbacks=None, force=False, wait=False, timeout=None, **properties)

Submit the task for execution.

Parameters:

Name Type Description Default
callbacks List[Callable]

The list of callable functions to be called on status change.

None
force bool

Force execution even if the data nodes are in cache.

False
wait bool

Wait for the orchestrated job created from the task submission to be finished in asynchronous mode.

False
timeout Union[float, int]

The maximum number of seconds to wait for the job to be finished before returning.

None
**properties dict[str, any]

A keyworded variable length list of additional arguments.

{}