- id: The id of the task configuration to be created. This id is mandatory and must be a unique and valid Python variable name.
- function: The function to execute.
- inputs: The input data nodes referring the parameter(s) data of the function to be executed.
- outputs: The output data nodes referring the result(s) data of the function to be executed.
Here is a simple example:
1 2 3 4 5 6 7 8 9
In the example above, we created a
In lines 3-4, we define a function that we want to use in a Task instantiated from the task config. It takes a single parameter and return a single value.
In lines 6-7, two data node configurations are created. They will be used respectively as the argument of the function double and as the result of the function double.
Finally, on line 9, we create the task configuration with the id 'double_task' that represents the function 'double' that expects an 'input' data node as an input parameter and returns an 'output' data node.
Because a Task can have several inputs and outputs,
taipy.configure_task()^ can receive lists of
1 2 3 4 5 6 7 8 9 10 11 12
In lines 3-4, we define a function with two parameters and two return values.
In lines 6-7, two data node configurations are created. They will be used as the function arguments.
In line 9-10, two data node are configured. They will be used as the function results.
Finally, in line 12, we create the task configuration with the id 'foo' representing the function 'multiply_and_add'. It expects two 'input' data nodes and two 'output' data nodes.