Create Entrypoints#
This how-to explains how to build Entrypoints in Dioptra.
Prerequisites#
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up Dioptra in the GUI - Access Dioptra services in the GUI, create a user, and login.
Create Plugins - Plugins are needed to attach to the Entrypoint
Create Queues - A queue is needed to attach to the Entrypoint
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up the Python Client - Connect to the Python Client in a Jupyter Notebook.
Create Plugins - Plugins are needed to attach to the Entrypoint
Create Queues - A queue is needed to attach to the Entrypoint
Entrypoint Creation Workflow#
Follow these steps to create an Entrypoint. You can perform these actions via the Graphical User Interface (GUI) or programmatically using the Python Client.
Step 1: Locate Plugins, Queues, Groups, and Parameter Types to attach to the Entrypoint#
Ensure you have created at least one plugin and at least one queue.
You will be able to automatically select these resources in the GUI using dropdown menus in the following steps.
Retrieve IDs for the following resources:
Plugins
Queues
Groups
Plugin Parameter Types
Groups:
- GroupsCollectionClient.get(index: int = 0, page_length: int = 10, search: str | None = None) dioptra.client.groups.T[source]#
Get a list of groups.
- Parameters
index – The paging index. Optional, defaults to 0.
page_length – The maximum number of groups to return in the paged response. Optional, defaults to 10.
search – Search for groups using the Dioptra API’s query language. Optional, defaults to None.
- Returns
The response from the Dioptra API.
Plugins:
- PluginsCollectionClient.get(group_id: int | None = None, index: int = 0, page_length: int = 10, sort_by: str | None = None, descending: bool | None = None, search: str | None = None) dioptra.client.plugins.T[source]#
Get a list of plugins.
- Parameters
group_id – The group id the plugins belong to. If None, return plugins from all groups that the user has access to. Optional, defaults to None.
index – The paging index. Optional, defaults to 0.
page_length – The maximum number of plugins to return in the paged response. Optional, defaults to 10.
sort_by – The field to use to sort the returned list. Optional, defaults to None.
descending – Sort the returned list in descending order. Optional, defaults to None.
search – Search for plugins using the Dioptra API’s query language. Optional, defaults to None.
- Returns
The response from the Dioptra API.
Parameter Types:
- PluginParameterTypesCollectionClient.get(group_id: int | None = None, index: int = 0, page_length: int = 10, sort_by: str | None = None, descending: bool | None = None, search: str | None = None) dioptra.client.plugin_parameter_types.T[source]#
Get a list of plugin parameter types.
- Parameters
group_id – The group id the plugin parameter types belong to. If None, return plugin parameter types from all groups that the user has access to. Optional, defaults to None.
index – The paging index. Optional, defaults to 0.
page_length – The maximum number of plugin parameter types to return in the paged response. Optional, defaults to 10.
sort_by – The field to use to sort the returned list. Optional, defaults to None.
descending – Sort the returned list in descending order. Optional, defaults to None.
search – Search for plugin parameter types using the Dioptra API’s query language. Optional, defaults to None.
- Returns
The response from the Dioptra API.
Queues:
- QueuesCollectionClient.get(group_id: int | None = None, index: int = 0, page_length: int = 10, sort_by: str | None = None, descending: bool | None = None, search: str | None = None) dioptra.client.queues.T[source]#
Get a list of queues.
- Parameters
group_id – The group id the queues belong to. If None, return queues from all groups that the user has access to. Optional, defaults to None.
index – The paging index. Optional, defaults to 0.
page_length – The maximum number of queues to return in the paged response. Optional, defaults to 10.
sort_by – The field to use to sort the returned list. Optional, defaults to None.
descending – Sort the returned list in descending order. Optional, defaults to None.
search – Search for queues using the Dioptra API’s query language. Optional, defaults to None.
- Returns
The response from the Dioptra API.
Step 2: Create an Entrypoint#
In the Dioptra GUI, navigate to the Entrypoints tab. Click Create. Enter metadata, including:
name
group
queues
description (optional)
Create the Entrypoint using the Client. Use the Group ID, Plugin IDs, Queue IDs, and Parameter Type IDs from step 1. Also pass in the following as parameters:
Task Graph YAML
Artifact Graph YAML (optional)
Parameters (optional)
Artifact Input Parameters (Optional)
Description (Optional)
Entrypoint client CREATE method:
- EntrypointsCollectionClient.create(group_id: int, name: str, task_graph: str, artifact_graph: str | None = None, description: str | None = None, parameters: list[dict[str, Any]] | None = None, artifact_parameters: list[dict[str, Any]] | None = None, queues: list[int] | None = None, plugins: list[int] | None = None, artifact_plugins: list[int] | None = None) dioptra.client.entrypoints.T[source]#
Creates a entrypoint.
- Parameters
group_id – The id of the group that will own the entrypoint.
name – The name of the new entrypoint.
task_graph – The task graph for the new entrypoint as a YAML-formatted string.
artifact_graph – The artifact graph for the new entrypoint as a YAML-formatted string. Optional, defaults to None. A None value indicates there are no produced artifacts that need to be stored.
description – The description of the new entrypoint. Optional, defaults to None.
parameters – The list of parameters for the new entrypoint. Optional, defaults to None.
artifact_parameters – The list of artifact parameters for the new entrypoint. Optional, defaults to None.
queues – A list of queue ids to associate with the new entrypoint. Optional, defaults to None.
plugins – A list of plugin ids to associate with the new entrypoint. Optional, defaults to None.
artifact_plugins – A list of artifact plugin ids to associate with the new entrypoint. Optional, defaults to None.
Example
Create an entrypoint called “hello_world” with artifact input parameters and artifact output graph.
entrypoint = client.entrypoints.create( group_id=GROUP_ID, name="hello_world", task_graph=TASK_GRAPH_YAML_STR, artifact_graph=ARTIFACT_TASK_GRAPH_YAML_STR, description="An entrypoint to run hello world task", parameters=[ { "name": "greeting", "defaultValue": "Hello", "parameterType": "string", }, { "name": "name", "defaultValue": "World", "parameterType": "string", }, ], artifact_parameters=[ { "name": "artifact_name", "outputParams": [ {"name": "value", "parameterType": STRING_PARAM_TYPE_ID} ], } ], queues=[QUEUE_ID_1], plugins=[PLUGIN_ID_1], artifact_plugins=[PLUGIN_ID_2], )
- Returns
The response from the Dioptra API.
Step 3: Add Entrypoint Parameters (optional)#
Entrypoints are parameterizable. Any parameters or artifact input parameters you create can be specified when an Entrypoint is run as a job.
On the Entrypoint creation page, go to the Entrypoint Parameters box and click Create.
For each parameter, enter the following:
Name
Type
Default Value (optional).
The parameter values were provided as a list of dictionaries during entrypoint creation in Step 2.
Step 4: Add Artifact Input Parameters (optional)#
If you would like this entrypoint to load an artifact from disk and make it available to the Task Graph, create an artifact input parameter.
On the Entrypoint creation page, go to the Artifact Parameters box and click Create.
For each artifact input parameter, provide the following:
Artifact Input Name
Output Parameters (one or more)
An artifact task can produce multiple output parameters in the deserialize() method. Which artifact handler is used is selected at job run time.
For each artifact input’s output parameter, provide the following:
Output Parameter Name
Output Parameter Type
The artifact input parameters values were provided as a list of dictionaries during entrypoint creation in Step 2.
Step 5. Create the Task Graph#
When an entrypoint is run as a job, the task graph will be executed by the worker in order. Define the Task Graph for the entrypoint.
On the Entrypoint creation page, scroll to the Task Graph Info box and select the Task Plugins dropdown - select any Plugins that you want to use for this Entrypoint.
In the Task Graph code editor, add YAML code that defines your Task Graph. You can also add tasks to the code editor by clicking add to task graph from the Function Tasks table.
The task graph YAML was provided as a string during entrypoint creation in Step 2.
The Plugin IDs for task plugins were provided during entrypoint creation in Step 2.
Step 6. Create the Artifact Task Graph (optional)#
If you want to save any objects from your entrypoint to disk, you need to define that logic in the Artifact Task Graph section.
On the Entrypoint creation page, scroll to the Artifact Info box and select the Artifact Task Plugins dropdown - select any plugins that you wish to use the Artifact Tasks from.
In the Artifact Output Graph code editor, add YAML code that defines your Artifact Output Graph. You can also add artifact tasks to the code editor by clicking add to task graph from the Artifact Tasks table.
The artifact output graph YAML is provided as a string during entrypoint creation.
The Plugin IDs for artifact plugins are provided during entrypoint creation.
See Also#
Entrypoints Explanation - Understand what entrypoints are conceptually.
Entrypoints Reference - See syntax and other reference material for entrypoints.
Task Graph Explanation - Learn more about the Task Graphs.
Artifacts Explanation - Learn about artifacts.