Pipelines

Functions

wrapica.pipelines.coerce_pipeline_id_or_code_to_pipeline_id(pipeline_id_or_code)

Given either a pipeline id or code, check if the input value is uuid4 format, If so, assume it is a pipeline id. Otherwise, assume it is a pipeline code and call get_project_pipeline_id_from_pipeline_code to get the pipeline id

Parameters:

pipeline_id_or_code (str) – The pipeline id or code to retrieve

Returns:

The pipeline id The pipeline id

Return type:

str

Raises:

ValueError: If the pipeline cannot be found

Examples:

1from wrapica.project_pipelines import coerce_pipeline_id_or_code_to_pipeline_id
2
3project_id = "project-123"
4pipeline_code = "pipeline-123"
5
6pipeline_id = coerce_pipeline_id_or_code_to_pipeline_id(project_id, pipeline_code)
wrapica.pipelines.coerce_pipeline_id_or_code_to_pipeline_obj(pipeline_id_or_code)

Given either a pipeline id or code, check if the input value is uuid4 format,

If so, assume it is a pipeline id and collect the object. Otherwise, assume it is a pipeline code and call get_pipeline_obj_from_pipeline_code to get the pipeline object

Parameters:

pipeline_id_or_code (str)

Returns:

The pipeline object

Return type:

Pipeline

Raises:

ValueError – If the pipeline cannot be found

Examples:

1from wrapica.project_pipelines import coerce_pipeline_id_or_code_to_pipeline_obj
2
3pipeline_code = "pipeline-123"
4
5pipeline_obj = coerce_pipeline_id_or_code_to_pipeline_obj(pipeline_code)
wrapica.pipelines.download_pipeline_file(pipeline_id, file_id, file_path=None)

Download pipeline file

Parameters:
  • pipeline_id (Union[UUID, str]) – The pipeline id

  • file_id (Union[UUID, str]) – The file id

  • file_path (Optional[Path]) – The file path to save the file to (if not set, the file content will be returned)

Returns:

The file content if file_path is not set

Return type:

BytesIO

Raises:

ApiException – If the file cannot be downloaded

Examples:

1from pathlib import Path
2from wrapica.pipelines import download_pipeline_file
3
4download_pipeline_file(
5    pipeline_id="pipeline_id",
6    file_id="file_id",
7    file_path=Path("path/to/file")
8)
wrapica.pipelines.download_pipeline_to_directory(pipeline_id, output_directory)

Download a pipeline to a directory

:param pipeline_id :param output_directory

Raises:
  • ApiException – If the pipeline files cannot be retrieved

  • AssertionError – If the parent directory does not exist

Examples:

1# Imports
2from pathlib import Path
3from wrapica.pipelines import download_pipeline_to_directory
4
5# Download pipeline to local directory
6download_pipeline_to_directory(
7    pipeline_id="pipeline_id",
8    output_directory=Path("path/to/output/directory")
9)
wrapica.pipelines.download_pipeline_to_zip(pipeline_id, zip_path)

Given a pipeline id, download the pipeline to a zip file

Parameters:
Returns:

wrapica.pipelines.get_cwl_obj_from_pipeline_id(pipeline_id)

Get the pipeline files from a project pipeline Arrange the files as they’re named to generate the workflow object

Parameters:

pipeline_id (Union[UUID, str])

Return type:

Union[Workflow, Workflow, Workflow]

Returns:

wrapica.pipelines.get_pipeline_obj_from_pipeline_code(pipeline_code)

Get the pipeline object from the pipeline code

Parameters:

pipeline_code (str)

Returns:

The pipeline object

Return type:

Pipeline

Raises:

ApiException – If the pipeline is not found

Examples:

 1from pathlib import Path
 2from wrapica.pipelines import get_pipeline_obj_from_pipeline_code
 3
 4# Use wrapica.pipelines.get_pipeline_obj_from_pipeline_id
 5# If you need to convert a pipeline id to a pipeline object
 6# Since get_pipeline_obj_from_pipeline_code will need to list all pipelines first
 7# To find a matching pipeline, if a user has a pipeline id, it is recommended to use
 8# get_pipeline_obj_from_pipeline_id instead of this function.
 9
10pipeline_obj: Pipeline = get_pipeline_obj_from_pipeline_code(
11    pipeline_code="pipeline_code"
12)
wrapica.pipelines.get_pipeline_obj_from_pipeline_id(pipeline_id)

Get the pipeline object from the pipeline id

Parameters:

pipeline_id (Union[UUID, str])

Returns:

The pipeline object

Return type:

Pipeline

Raises:

ApiException – If the pipeline is not found

Examples:

1from pathlib import Path
2from wrapica.pipelines import get_pipeline_obj_from_pipeline_id
3
4# Use wrapica.pipelines.get_pipeline_obj_from_pipeline_code
5# If you need to convert a pipeline code to a pipeline object
6
7pipeline_obj: Pipeline = get_pipeline_obj_from_pipeline_id(
8    pipeline_id="pipeline_id"
9)
wrapica.pipelines.list_all_pipelines()

List all pipelines available to a user through the pipelines/ endpoint

Returns:

List of pipelines

Return type:

List[Pipeline]

Raises:

ApiException – If the pipeline list cannot be retrieved

Examples:

1from pathlib import Path
2from wrapica.pipelines import list_all_pipelines
3
4pipelines: List[Pipeline] = list_all_pipelines()
wrapica.pipelines.list_pipeline_files(pipeline_id)

List pipeline files

Parameters:

pipeline_id (Union[UUID, str])

Returns:

List of pipeline files

Return type:

List[PipelineFile]

Raises:

ApiException – If the pipeline files cannot be retrieved

Examples:

1# Imports
2from wrapica.pipelines import list_pipeline_files
3
4# List pipeline files
5pipeline_files: List[PipelineFile] = list_pipeline_files(
6    pipeline_id="pipeline_id"
7)