cirro.sdk.process
1from typing import List, Union 2 3from cirro_api_client.v1.models import Process, Executor, ProcessDetail, CustomPipelineSettings, PipelineCode 4 5from cirro.cirro_client import CirroApi 6from cirro.models.form_specification import ParameterSpecification 7from cirro.sdk.asset import DataPortalAssets, DataPortalAsset 8 9 10class DataPortalProcess(DataPortalAsset): 11 """Helper functions for interacting with analysis processes.""" 12 13 def __init__(self, process: Union[Process, ProcessDetail], client: CirroApi): 14 """ 15 Instantiate with helper method 16 17 ```python 18 from cirro import DataPortal() 19 portal = DataPortal() 20 process = portal.get_process_by_name("Process Name") 21 ``` 22 """ 23 self._data = process 24 self._client = client 25 26 @property 27 def id(self) -> str: 28 """Unique identifier""" 29 return self._data.id 30 31 @property 32 def name(self) -> str: 33 """Readable name""" 34 return self._data.name 35 36 @property 37 def description(self) -> str: 38 """Longer description of process""" 39 return self._data.description 40 41 @property 42 def child_process_ids(self) -> List[str]: 43 """List of processes which can be run on the output of this process""" 44 return self._data.child_process_ids 45 46 @property 47 def executor(self) -> Executor: 48 """INGEST, CROMWELL, or NEXTFLOW""" 49 return self._data.executor 50 51 @property 52 def category(self) -> str: 53 """Category of process""" 54 return self._data.category 55 56 @property 57 def pipeline_type(self) -> str: 58 """Pipeline type""" 59 return self._data.pipeline_type 60 61 @property 62 def documentation_url(self) -> str: 63 """Documentation URL""" 64 return self._data.documentation_url 65 66 @property 67 def file_requirements_message(self) -> str: 68 """Description of files required for INGEST processes""" 69 return self._data.file_requirements_message 70 71 @property 72 def code(self) -> PipelineCode: 73 """Pipeline code configuration""" 74 return self._get_detail().pipeline_code 75 76 @property 77 def custom_settings(self) -> CustomPipelineSettings: 78 """Custom settings for the process""" 79 return self._get_detail().custom_settings 80 81 def _get_detail(self) -> ProcessDetail: 82 if not isinstance(self._data, ProcessDetail): 83 self._data = self._client.processes.get(self.id) 84 return self._data 85 86 def __str__(self): 87 return '\n'.join([ 88 f"{i.title()}: {self.__getattribute__(i)}" 89 for i in ['name', 'id', 'description'] 90 ]) 91 92 def get_parameter_spec(self) -> ParameterSpecification: 93 """ 94 Gets a specification used to describe the parameters used in the process. 95 """ 96 return self._client.processes.get_parameter_spec(self.id) 97 98 99class DataPortalProcesses(DataPortalAssets[DataPortalProcess]): 100 """Collection of DataPortalProcess objects.""" 101 asset_name = "process"
11class DataPortalProcess(DataPortalAsset): 12 """Helper functions for interacting with analysis processes.""" 13 14 def __init__(self, process: Union[Process, ProcessDetail], client: CirroApi): 15 """ 16 Instantiate with helper method 17 18 ```python 19 from cirro import DataPortal() 20 portal = DataPortal() 21 process = portal.get_process_by_name("Process Name") 22 ``` 23 """ 24 self._data = process 25 self._client = client 26 27 @property 28 def id(self) -> str: 29 """Unique identifier""" 30 return self._data.id 31 32 @property 33 def name(self) -> str: 34 """Readable name""" 35 return self._data.name 36 37 @property 38 def description(self) -> str: 39 """Longer description of process""" 40 return self._data.description 41 42 @property 43 def child_process_ids(self) -> List[str]: 44 """List of processes which can be run on the output of this process""" 45 return self._data.child_process_ids 46 47 @property 48 def executor(self) -> Executor: 49 """INGEST, CROMWELL, or NEXTFLOW""" 50 return self._data.executor 51 52 @property 53 def category(self) -> str: 54 """Category of process""" 55 return self._data.category 56 57 @property 58 def pipeline_type(self) -> str: 59 """Pipeline type""" 60 return self._data.pipeline_type 61 62 @property 63 def documentation_url(self) -> str: 64 """Documentation URL""" 65 return self._data.documentation_url 66 67 @property 68 def file_requirements_message(self) -> str: 69 """Description of files required for INGEST processes""" 70 return self._data.file_requirements_message 71 72 @property 73 def code(self) -> PipelineCode: 74 """Pipeline code configuration""" 75 return self._get_detail().pipeline_code 76 77 @property 78 def custom_settings(self) -> CustomPipelineSettings: 79 """Custom settings for the process""" 80 return self._get_detail().custom_settings 81 82 def _get_detail(self) -> ProcessDetail: 83 if not isinstance(self._data, ProcessDetail): 84 self._data = self._client.processes.get(self.id) 85 return self._data 86 87 def __str__(self): 88 return '\n'.join([ 89 f"{i.title()}: {self.__getattribute__(i)}" 90 for i in ['name', 'id', 'description'] 91 ]) 92 93 def get_parameter_spec(self) -> ParameterSpecification: 94 """ 95 Gets a specification used to describe the parameters used in the process. 96 """ 97 return self._client.processes.get_parameter_spec(self.id)
Helper functions for interacting with analysis processes.
DataPortalProcess( process: Union[cirro_api_client.v1.models.Process, cirro_api_client.v1.models.ProcessDetail], client: cirro.CirroApi)
14 def __init__(self, process: Union[Process, ProcessDetail], client: CirroApi): 15 """ 16 Instantiate with helper method 17 18 ```python 19 from cirro import DataPortal() 20 portal = DataPortal() 21 process = portal.get_process_by_name("Process Name") 22 ``` 23 """ 24 self._data = process 25 self._client = client
Instantiate with helper method
from cirro import DataPortal()
portal = DataPortal()
process = portal.get_process_by_name("Process Name")
description: str
37 @property 38 def description(self) -> str: 39 """Longer description of process""" 40 return self._data.description
Longer description of process
child_process_ids: List[str]
42 @property 43 def child_process_ids(self) -> List[str]: 44 """List of processes which can be run on the output of this process""" 45 return self._data.child_process_ids
List of processes which can be run on the output of this process
executor: cirro_api_client.v1.models.Executor
47 @property 48 def executor(self) -> Executor: 49 """INGEST, CROMWELL, or NEXTFLOW""" 50 return self._data.executor
INGEST, CROMWELL, or NEXTFLOW
category: str
52 @property 53 def category(self) -> str: 54 """Category of process""" 55 return self._data.category
Category of process
pipeline_type: str
57 @property 58 def pipeline_type(self) -> str: 59 """Pipeline type""" 60 return self._data.pipeline_type
Pipeline type
documentation_url: str
62 @property 63 def documentation_url(self) -> str: 64 """Documentation URL""" 65 return self._data.documentation_url
Documentation URL
file_requirements_message: str
67 @property 68 def file_requirements_message(self) -> str: 69 """Description of files required for INGEST processes""" 70 return self._data.file_requirements_message
Description of files required for INGEST processes
72 @property 73 def code(self) -> PipelineCode: 74 """Pipeline code configuration""" 75 return self._get_detail().pipeline_code
Pipeline code configuration
custom_settings: cirro_api_client.v1.models.CustomPipelineSettings
77 @property 78 def custom_settings(self) -> CustomPipelineSettings: 79 """Custom settings for the process""" 80 return self._get_detail().custom_settings
Custom settings for the process
100class DataPortalProcesses(DataPortalAssets[DataPortalProcess]): 101 """Collection of DataPortalProcess objects.""" 102 asset_name = "process"
Collection of DataPortalProcess objects.