Upgrade pipeline endpoints to SDK v2
Once you have a pipeline up and running, you can publish a pipeline so that it runs with different inputs. This was known as Published Pipelines.
What has changed?
Batch Endpoint proposes a similar yet more powerful way to handle multiple assets running under a durable API, which is why the Published pipelines functionality was moved to Pipeline component deployments in batch endpoints.
Batch endpoints decouples the interface (endpoint) from the actual implementation (deployment) and allow the user to decide which deployment serves the default implementation of the endpoint. Pipeline component deployments in batch endpoints allow users to deploy pipeline components instead of pipelines, which make a better use of reusable assets for those organizations looking to streamline their MLOps practice.
The following table shows a comparison of each of the concepts:
Concept | SDK v1 | SDK v2 |
---|---|---|
Pipeline's REST endpoint for invocation | Pipeline endpoint | Batch endpoint |
Pipeline's specific version under the endpoint | Published pipeline | Pipeline component deployment |
Pipeline's arguments on invocation | Pipeline parameter | Job inputs |
Job generated from a published pipeline | Pipeline job | Batch job |
To learn how to create your first pipeline component deployment see How to deploy pipelines in Batch Endpoints.
Moving to batch endpoints
Use the following guidelines to learn how to move from SDK v1 to SDK v2 using the concepts in Batch Endpoints.
Publish a pipeline
Compare how publishing a pipeline has changed from v1 to v2:
First, we need to get the pipeline we want to publish:
pipeline1 = Pipeline(workspace=ws, steps=[step1, step2])
We can publish the pipeline as follows:
from azureml.pipeline.core import PipelineEndpoint endpoint_name = "PipelineEndpointTest" pipeline_endpoint = PipelineEndpoint.publish( workspace=ws, name=endpoint_name, pipeline=pipeline, description="A hello world endpoint for component deployments" )
Submit a job to a pipeline endpoint
To call the default version of the pipeline, you can use:
pipeline_endpoint = PipelineEndpoint.get(workspace=ws, name="PipelineEndpointTest")
run_id = pipeline_endpoint.submit("PipelineEndpointExperiment")
You can also submit a job to a specific version:
Get all pipelines deployed
Using the REST API
You can create jobs from the endpoints by using the REST API of the invocation URL. See the following examples to see how invocation has changed from v1 to v2.
pipeline_endpoint = PipelineEndpoint.get(workspace=ws, name=endpoint_name)
rest_endpoint = pipeline_endpoint.endpoint
response = requests.post(
rest_endpoint,
headers=aad_token,
json={
"ExperimentName": "PipelineEndpointExperiment",
"RunSource": "API",
"ParameterAssignments": {"argument1": "united", "argument2":45}
}
)
Next steps
Povratne informacije
https://aka.ms/ContentUserFeedback.
Uskoro: tokom 2024. postepeno ćemo ukidati probleme s uslugom GitHub kao mehanizam povratnih informacija za sadržaj i zamijeniti ga novim sistemom povratnih informacija. Za više informacija, pogledajtePošalјite i prikažite povratne informacije za