Skip to content

Manage a step

Summary:

  1. Find and get information about steps
  2. Delete steps
Function Name Method Return Type Description
get_step get_step (step_name) dict Get information about a step.
list_steps list_steps() list of dict Get a list of available steps.
delete_step delete_step (step_name) dict[str, str] Delete one step.

❓ For step update and deletion, you need the name (the name you provide when creating the step) of the step you want to update/delete. You can find it with function list_steps() (see the previous part).

Find and get information about steps

To get information about a step, we need its name in the environment. You can search its name in the list of step’s name of the environment.

Get list of steps

Function definition

To get all steps available in the current environment, you can get a list of step name with this function:

CraftAiSdk.list_steps()

Returns

List of steps represented as dict with the following keys:

  • name (str): Name of the step.
  • status (str): either Pending or Ready.
  • created_at (str): The creation date in ISO format.
  • updated_at (str): The last update date in ISO format.
  • repository_branch (str): The branch of the repository where the step was built.
  • repository_url (str): The url of the repository where the step was built.
  • commit_id (str): The commit id on which the step was built.

Get information about one step

Function definition

Get all information (repository, dependency, …) about one step in the current environment with its name.

CraftAiSdk.get_step(step_name)

Parameters

  • step_name (str) – The name of the step to get.

Returns

dict: None if the step does not exist; otherwise the step information, with the following keys:

  • parameters (dict): Information used to create the step with the following keys:
  • step_name (str): Name of the step.
  • function_path (str): Path to the file that contains the function.
  • function_name (str): Name of the function in that file.
  • description (str): Description.
  • inputs (list of dict): List of inputs represented as a dict with the following keys:
    • name (str): Input name.
    • data_type (str): Input data type.
    • is_required (bool): Whether the input is required.
    • default_value (str): Input default value.
  • outputs (list of dict): List of outputs represented as a dict with the following keys:
    • name (str): Output name.
    • data_type (str): Output data type.
    • description (str): Output description.
  • container_config (dict[str, str]): Some step configuration, with the following optional keys:
    • language (str): Language and version used for the step.
    • repository_url (str): Remote repository url.
    • repository_branch (str): Branch name.
    • included_folders (list[str]): List of folders and files in the repository required for the step execution.
    • system_dependencies (list[str]): List of system dependencies.
    • dockerfile_path (str): Path to the Dockerfile.
    • requirements_path (str): Path to the requirements.txt file.
  • creation_info (dict): Information about the step creation:
  • created_at (str): The creation date in ISO format.
  • updated_at (str): The last update date in ISO format.
  • commit_id (str): The commit id on which the step was built.
  • status (str): Either "Pending" or "Ready".

Delete steps

Delete steps function

Function definition

Delete step in the environment with his name.

CraftAiSdk.delete_step(step_name, force_dependents_deletion=False)

Parameters

  • step_name (str) – Name of the step to delete as defined in the create step function.
  • force_dependents_deletion (bool, optional) – if True the associated step’s dependencies will be deleted too (pipeline, pipeline executions, deployments). Defaults to False.

Returns

Deleted step represented as dict (with key “name”). The return type is a dict [str, str].

Warning

You can't delete a step that is used in a pipeline. You must delete the pipeline before or use the force_dependents_deletion parameter during step deletion.