6.1 Choose a deployment method
A deployment is a way to run a Machine Learning pipeline in a repeatable and automated way.
For each deployment, you can configure a deployment methods:
by endpoint (web API) : the pipeline will be executed by a call to a web API. In addition, this API will allow, if necessary, to retrieve data as input and deliver the result of the pipeline as output. Access to the API can be securely communicated to external users.
Function name |
Method |
Return type |
Description |
---|---|---|---|
create_deployment |
create_deployment(name, pipeline_name, execution_rule, outputs_mapping=[], inputs_mapping=[]) |
Dict |
Function that deploy a pipeline by creating a deployment which allows a user to trigger the pipeline execution |
6.1.1 Deploy by endpoint
6.1.1.1 Definition function
To create an auto-mapping deployment where all inputs and outputs are
based on API calls, you can use the create_deployment
function. To
create a deployment with manual mapping, you can use the
create_deployment
function with the additional parameters
inputs_mapping
to specify the precise mapping between input and
source.
Warning
Outputs mapping always needs to be precised. Auto-mapping is only available for inputs.
Parameters
deployment_name
(str) – Name of endpoint chosen by the user to refer to the endpointpipeline_name
(str) – Name of pipeline that will be run by the deployment / endpointexecution_rule
(str) - Execution rule of the deployment. For the moment, only “endpoint” is available.description
(str, optional) – Text description of usage of pipeline for user onlyoutputs_mapping
(List) - List of all OutputDestination objects with information for each input mapping.inputs_mapping
(List, optional) - List of all InputSource objects with information for each output mapping.
Returns
Information about the deployment just create in a dict Python format. In this data, you will have :
id - Unique identifier of the deployment
name - Name of the deployment
endpoint_token - Token used for authentication when making requests to the endpoint
inputs_mapping - Information about the mapping between the sources of the deployment and the inputs of the pipeline
step_input_name - Name of the input in the pipeline
endpoint_input_name - Name of the source in the deployment
constant_value - Default value for the input if the source is missing
environment_variable_name - The name of an environment variable
is_null - A flag indicating that the input should not be provided any value at execution time
outputs_mapping - Information about the mapping between the destinations of the deployment and the outputs of the pipeline
step_output_name - Name of the output in the pipeline
endpoint_output_name - Name of the destination in the deployment
is_null - This flag indicates that the output will be deleted after execution.
pipeline - Information about the pipeline that will be run by the deployment
name - Name of the pipeline
6.1.1.2 Example
Example auto mapping
sdk.create_deployment(
deployment_name="my_deployment",
pipeline_name="my_pipeline",
execution_rule="endpoint",
outputs_mapping=[prediction_endpoint_ouput],
inputs_mapping=[],
)
Example manual mapping
sdk.create_deployment(
deployment_name="my_deployment",
pipeline_name="my_pipeline",
execution_rule="endpoint",
outputs_mapping=[prediction_endpoint_ouput],
inputs_mapping=[
seagull_endpoint_input,
big_whale_input,
salt_constant_input,
],
)
Example of return object
{
'id': '29d0c371-49ec-4071-a879-10cdab00fda4',
'name': 'my_deployment',
'endpoint_token': 'EWwIii [...] kjdD5Q',
'inputs_mapping':
[{
'step_input_name': 'seagull',
'endpoint_input_name': 'sourceData'
},
{
'step_input_name': 'big_whale',
'constant_value': 5
},],
'outputs_mapping':
[{
'step_output_name': 'resultMulti',
'endpoint_output_name': 'resultMulti'
}],
'pipeline': {
'name': 'my_pipeline'
}
}