Skip to content

taipy.core.Task

Bases: _Entity

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 (pipeline_id, scenario_id, cycle_id) or None.

parent_ids Optional[Set[str]]

The set of identifiers of the parent pipelines.

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.

parent_id writable property

Deprecated. Use owner_id instead.

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_parents()

Get parents of the task.

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

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 scheduled 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