module aixplain.modules.pipeline.asset
class Pipeline
Representing a custom pipeline that was created on the aiXplain Platform
Attributes:
id
(Text): ID of the Pipelinename
(Text): Name of the Pipelineapi_key
(Text): Team API Key to run the Pipeline.url
(Text, optional): running URL of platform. Defaults to config.BACKEND_URL.supplier
(Text, optional): Pipeline supplier. Defaults to "aiXplain".version
(Text, optional): version of the pipeline. Defaults to "1.0".**additional_info
: Any additional Pipeline info to be saved
method __init__
__init__(
id: str,
name: str,
api_key: str,
url: str = 'https://platform-api.aixplain.com',
supplier: str = 'aiXplain',
version: str = '1.0',
**additional_info
) → None
Create a Pipeline with the necessary information
Args:
id
(Text): ID of the Pipelinename
(Text): Name of the Pipelineapi_key
(Text): Team API Key to run the Pipeline.url
(Text, optional): running URL of platform. Defaults to config.BACKEND_URL.supplier
(Text, optional): Pipeline supplier. Defaults to "aiXplain".version
(Text, optional): version of the pipeline. Defaults to "1.0".**additional_info
: Any additional Pipeline info to be saved
method delete
delete() → None
Delete Dataset service
method poll
poll(poll_url: str, name: str = 'pipeline_process') → Dict
Poll the platform to check whether an asynchronous call is done.
Args:
poll_url
(Text): polling URLname
(Text, optional): ID given to a call. Defaults to "pipeline_process".
Returns:
Dict
: response obtained by polling call
method run
run(
data: Union[str, Dict],
data_asset: Optional[str, Dict] = None,
name: str = 'pipeline_process',
timeout: float = 20000.0,
wait_time: float = 1.0,
batch_mode: bool = True,
**kwargs
) → Dict
Runs a pipeline call.
Args:
data
(Union[Text, Dict]): link to the input datadata_asset
(Optional[Union[Text, Dict]], optional): Data asset to be processed by the pipeline. Defaults to None.name
(Text, optional): ID given to a call. Defaults to "pipeline_process".timeout
(float, optional): total polling time. Defaults to 20000.0.wait_time
(float, optional): wait time in seconds between polling calls. Defaults to 1.0.batch_mode
(bool, optional): Whether to run the pipeline in batch mode or online. Defaults to True.kwargs
: A dictionary of keyword arguments. The keys are the argument names
Returns:
Dict
: parsed output from pipeline
method run_async
run_async(
data: Union[str, Dict],
data_asset: Optional[str, Dict] = None,
name: str = 'pipeline_process',
batch_mode: bool = True,
**kwargs
) → Dict
Runs asynchronously a pipeline call.
Args:
data
(Union[Text, Dict]): link to the input datadata_asset
(Optional[Union[Text, Dict]], optional): Data asset to be processed by the pipeline. Defaults to None.name
(Text, optional): ID given to a call. Defaults to "pipeline_process".batch_mode
(bool, optional): Whether to run the pipeline in batch mode or online. Defaults to True.kwargs
: A dictionary of keyword arguments. The keys are the argument names
Returns:
Dict
: polling URL in response
method save
save(save_as_asset: bool = False, api_key: Optional[str] = None)
Save Pipeline
Args:
save_as_asset
(bool, optional): Save as asset (True) or draft (False). Defaults to False.api_key
(Optional[Text], optional): Team API Key to create the Pipeline. Defaults to None.
Raises:
Exception
: Make sure the pipeline to be save is in a JSON file.
method update
update(
pipeline: Union[str, Dict],
save_as_asset: bool = False,
api_key: Optional[str] = None,
name: Optional[str] = None
)
Update Pipeline
Args:
pipeline
(Union[Text, Dict]): Pipeline as a Python dictionary or in a JSON filesave_as_asset
(bool, optional): Save as asset (True) or draft (False). Defaults to False.api_key
(Optional[Text], optional): Team API Key to create the Pipeline. Defaults to None.
Raises:
Exception
: Make sure the pipeline to be save is in a JSON file.