Pipeline

class previsionio.pipeline.PipelineScheduledRun(_id: str, name: str, project_id: str, pipeline_template: Dict, pipeline_template_id: str, nodes_properties: List, exec_type: str, enabled: bool, description: str = None, draft: bool = True, created_at: str = None, **kwargs)

Bases: previsionio.api_resource.ApiResource

delete()

Delete a PipelineScheduledRun.

Raises:
  • PrevisionException – If the project does not exist
  • requests.exceptions.ConnectionError – Error processing the request
classmethod from_id(_id: str) → previsionio.pipeline.PipelineScheduledRun

Get a pipeline scheduled run from the platform by its unique id.

Parameters:_id (str) – Unique id of the pipeline scheduled run to retrieve
Returns:Fetched experiment
Return type:PipelineScheduledRun
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_executions(limit: int = 15)

Get executions of a pipeline scheduled run.

Parameters:limit (int) – Number of executions to retrieve.
Returns:list(dict)
classmethod list(project_id: str, all: bool = True)

List all the available pipeline scheduled runs in the current active [client] workspace.

Warning

Contrary to the parent list() function, this method returns actual PipelineScheduledRun objects rather than plain dictionaries with the corresponding data.

Parameters:
  • project_id (str) – Unique reference of the project id on the platform
  • all (boolean, optional) – Whether to force the SDK to load all items of the given type (by calling the paginated API several times). Else, the query will only return the first page of result.
Returns:

Fetched PipelineScheduledRun objects

Return type:

list(PipelineScheduledRun)

classmethod new(project_id, pipeline_template_id, name, description=None, nodes_params=[], exec_type='manual', exec_cron=None, exec_period_start=None, exec_period_end=None)

Create a pipeline Scheduled Run.

Parameters:
  • project_id (str) – project id
  • pipeline_template_id (str) – pipeline template id
  • name (str) – pipeline scheduled run name
  • description (str, optional) – Pipeline scheduled run description
  • nodes_params (list(dict)) – Pipeline Nodes parameters. E.g [{‘_id’: ‘xxx’, ‘properties’:{‘property_name’: ‘property_value’}}
  • exec_type (str, optional) – Run mode, possible values: manual or recurring (default: manual)
  • exec_cron (str, optional) – Cron for recurring pipeline scheduled run
  • exec_period_start (str, optional) – Start period of recurring pipeline scheduled run
  • exec_period_end (str, optional) – End period of recurring pipeline scheduled run
Returns:

Newly created PipelineScheduledRun

Return type:

PipelineScheduledRun

Raises:

PrevisionException – Any error while fetching data from the platform or parsing result

trigger()

Trigger an execution of a pipeline scheduled run.

class previsionio.pipeline.PipelineTemplate(_id, name, project_id, nodes, edges, description=None, draft=True, used_in_run=False, **kwargs)

Bases: previsionio.api_resource.ApiResource

create_scheduled_run(name, description=None, nodes_params=[], exec_type='manual', exec_cron=None, exec_period_start=None, exec_period_end=None) → previsionio.pipeline.PipelineScheduledRun

Create a pipeline Scheduled Run.

Parameters:
  • name (str) – pipeline scheduled run name
  • description (str, optional) – Pipeline scheduled run description
  • nodes_params (list(dict)) – Pipeline Nodes parameters. E.g [{‘_id’: ‘xxx’, ‘properties’:{‘property_name’: ‘property_value’}}
  • exec_type (str, optional) – Run mode, possible values: manual or recurring (default: manual)
  • exec_cron (str, optional) – Cron for recurring pipeline scheduled run
  • exec_period_start (str, optional) – Start period of recurring pipeline scheduled run
  • exec_period_end (str, optional) – End period of recurring pipeline scheduled run
Returns:

Newly created PipelineScheduledRun

Return type:

PipelineScheduledRun

Raises:

PrevisionException – Any error while fetching data from the platform or parsing result

delete()

Delete a PipelineTemplate.

Raises:
  • PrevisionException – If the project does not exist
  • requests.exceptions.ConnectionError – Error processing the request
classmethod from_id(_id: str) → previsionio.pipeline.PipelineTemplate

Get a pipeline template run from the platform by its unique id.

Parameters:_id (str) – Unique id of the pipeline template run to retrieve
Returns:Fetched experiment
Return type:PipelineTemplate
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_nodes_properties()

Get nodes properties of pipeline template run.

Returns:Information about nodes properties:
  • _id: str
  • name: str
  • properties: dict<property_name:property_type>
Return type:list(dict)
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
classmethod list(project_id: str, all: bool = True)

List all the available pipeline templates in the current active [client] workspace.

Warning

Contrary to the parent list() function, this method returns actual PipelineTemplate objects rather than plain dictionaries with the corresponding data.

Parameters:
  • project_id (str) – Unique reference of the project id on the platform
  • all (boolean, optional) – Whether to force the SDK to load all items of the given type (by calling the paginated API several times). Else, the query will only return the first page of result.
Returns:

Fetched PipelineTemplate objects

Return type:

list(PipelineTemplate)