Skip to content

Visual elements

Taipy provides some visual elements dedicated useful for Task orchestration. These elements are the scenario selector, the scenario viewer, and the job selector.

Scenario Selector

The scenario selector control (scenario_selector) is designed to create and select scenarios easily. It provides users with the ability to switch between them seamlessly.

The default usage is really simple. It does not require any specific configuration to display the selectable scenarios. The following image shows the default behavior of the scenario selector control when three scenarios exist.

The list of selectable scenarios

When the "Add scenario" button is pressed, a form is displayed to create a new scenario with the desired settings, in particular the ScenarioConfig used to instantiate the new scenario. The following image shows the form to create a new scenario.

The list of selectable data nodes

Thanks to its rich configurability, you can greatly customize the display of the scenario selector, for example, adding a search bar, adding a filter or a sort capability, grouping the scenarios by cycle, etc. For more details, see the scenario selector page.

Scenario Viewer

The scenario viewer control (scenario) displays a scenario's information and lets end-users interact with it.

The default usage is really simple. It does not require any specific configuration to display a selected scenario.

The selected scenario

All the information about the scenario is displayed and various buttons are available to interact with the scenario. In particular, the end-user can submit the scenario for execution, using the top right button "Submit". The scenario's sequences are also displayed, and the end-user can create, delete or submit them. Most of the fields and interactions are customizable.

For more details, see the scenario viewer page.

Job selector

The job selector control (job_selector) displays the list of jobs submitted to a Taipy application. It lists all the jobs with other related information, in particular the job status, and provides users with the ability to select a job.

As usual, the default usage is really simple. It does not require any specific configuration to get the following display.

The job list

Thanks to its rich configurability, you can customize the columns to display in job selector. For more details, see the job selector page.

Task orchestration interface

Once your execution graph is modeled as data nodes and tasks, it becomes easy to get a user interface to manage and monitor your submissions. The combination of the scenario selector, the scenario viewer, and the job selector controls provides a user-friendly interface covering the whole task orchestration functionalities.

Combining visual elements

The following image shows an example of how to combine the scenario selector, the scenario viewer, and the job selector controls. On the top, the scenario selector displays all the scenarios that can be selected. Below, the scenario viewer displays the selected scenario. Finally, the job selector displays the list of jobs created and submitted through the submission of scenarios and sequences in the scenario viewer.

Task orchestration interface

The following code shows a complete example of how to combine the visual elements. It consists of creating a dumb function named "identity" and used to create a scenario configuration. A user interface is created with the three controls thanks to the GUI service.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from taipy import Config, Orchestrator, Gui


# Implementing a function to be used as a Taipy task in a scenario
def identity(*values):
    return values

if __name__ == "__main__":
    # Creating a scenario variable and a job variable to be bound to the visual elements
    scenario = None
    job = None

    # Configuring a scenario
    in_cfg = Config.configure_data_node(id="inpt", default_data="IN")
    out_cfg = Config.configure_data_node(id="outpt")
    task_cfg = Config.configure_task(id="fct", function=identity, input=[in_cfg], output=[out_cfg])
    scenario_cfg = Config.configure_scenario(id="scenario", task_configs=[task_cfg])

    Orchestrator().run()

    # Running the GUI with a scenario selector, a scenario viewer, and a job selector
    page = ("""<|{scenario}|scenario_selector|>
<|{scenario}|scenario|>
<|{job}|job_selector|>
""")
    Gui(page=page).run()