Skip to content

Commit 881cc7b

Browse files
Merge pull request #267802 from santiagxf/santiagxf-patch-1
Update how-to-access-data-batch-endpoints-jobs.md
2 parents aef1885 + 326fd20 commit 881cc7b

File tree

1 file changed

+177
-105
lines changed

1 file changed

+177
-105
lines changed

articles/machine-learning/how-to-access-data-batch-endpoints-jobs.md

Lines changed: 177 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,184 @@ To successfully invoke a batch endpoint and create jobs, ensure you have the fol
8080
> [!TIP]
8181
> If you are using a credential-less data store or external Azure Storage Account as data input, ensure you [configure compute clusters for data access](how-to-authenticate-batch-endpoint.md#configure-compute-clusters-for-data-access). **The managed identity of the compute cluster** is used **for mounting** the storage account. The identity of the job (invoker) is still used to read the underlying data allowing you to achieve granular access control.
8282
83+
## Create jobs basics
8384
85+
To create a job from a batch endpoint you have to invoke it. Invocation can be done using the Azure CLI, the Azure Machine Learning SDK for Python, or a REST API call. The following examples show the basics of invocation for a batch endpoint that receives a single input data folder for processing. See [Understanding inputs and outputs](how-to-access-data-batch-endpoints-jobs.md#understanding-inputs-and-outputs) for examples with different inputs and outputs.
86+
87+
# [Azure CLI](#tab/cli)
88+
89+
Use the `invoke` operation under batch endpoints:
90+
91+
```azurecli
92+
az ml batch-endpoint invoke --name $ENDPOINT_NAME \
93+
--input https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data
94+
```
95+
96+
# [Python](#tab/sdk)
97+
98+
Use the method `MLClient.batch_endpoints.invoke()` to specify the name of the experiment:
99+
100+
```python
101+
job = ml_client.batch_endpoints.invoke(
102+
endpoint_name=endpoint.name,
103+
inputs={
104+
"heart_dataset": Input("https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data")
105+
}
106+
)
107+
```
108+
109+
# [REST](#tab/rest)
110+
111+
Make a `POST` request to the invocation URL of the endpoint. You can get the invocation URL from Azure Machine Learning portal, in the endpoint's details page.
112+
113+
__Body__
114+
115+
```json
116+
{
117+
"properties": {
118+
"InputData": {
119+
"heart_dataset": {
120+
"JobInputType" : "UriFolder",
121+
"Uri": "https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data"
122+
}
123+
}
124+
}
125+
}
126+
```
127+
128+
__Request__
129+
130+
```http
131+
POST jobs HTTP/1.1
132+
Host: <ENDPOINT_URI>
133+
Authorization: Bearer <TOKEN>
134+
Content-Type: application/json
135+
```
136+
---
137+
138+
### Invoke a specific deployment
139+
140+
Batch endpoints can host multiple deployments under the same endpoint. The default endpoint is used unless the user specifies otherwise. You can change the deployment that is used as follows:
141+
142+
# [Azure CLI](#tab/cli)
143+
144+
Use the argument `--deployment-name` or `-d` to specify the name of the deployment:
145+
146+
```azurecli
147+
az ml batch-endpoint invoke --name $ENDPOINT_NAME \
148+
--deployment-name $DEPLOYMENT_NAME \
149+
--input https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data
150+
```
151+
152+
# [Python](#tab/sdk)
153+
154+
Use the parameter `deployment_name` to specify the name of the deployment:
155+
156+
```python
157+
job = ml_client.batch_endpoints.invoke(
158+
endpoint_name=endpoint.name,
159+
deployment_name=deployment.name,
160+
inputs={
161+
"heart_dataset": Input("https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data")
162+
}
163+
)
164+
```
165+
166+
# [REST](#tab/rest)
167+
168+
Add the header `azureml-model-deployment` to your request, including the name of the deployment you want to invoke.
169+
170+
__Body__
171+
172+
```json
173+
{
174+
"properties": {
175+
"InputData": {
176+
"heart_dataset": {
177+
"JobInputType" : "UriFolder",
178+
"Uri": "https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data"
179+
}
180+
}
181+
}
182+
}
183+
```
184+
185+
__Request__
186+
187+
```http
188+
POST jobs HTTP/1.1
189+
Host: <ENDPOINT_URI>
190+
Authorization: Bearer <TOKEN>
191+
Content-Type: application/json
192+
azureml-model-deployment: DEPLOYMENT_NAME
193+
```
194+
---
195+
196+
### Configure job properties
197+
198+
You can configure some of the properties in the created job at invocation time.
199+
200+
> [!NOTE]
201+
> Configuring job properties is only available in batch endpoints with Pipeline component deployments by the moment.
202+
203+
#### Configure experiment name
204+
205+
# [Azure CLI](#tab/cli)
206+
207+
Use the argument `--experiment-name` to specify the name of the experiment:
208+
209+
```azurecli
210+
az ml batch-endpoint invoke --name $ENDPOINT_NAME \
211+
--experiment-name "my-batch-job-experiment" \
212+
--input https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data
213+
```
214+
215+
# [Python](#tab/sdk)
216+
217+
Use the parameter `experiment_name` to specify the name of the experiment:
218+
219+
```python
220+
job = ml_client.batch_endpoints.invoke(
221+
endpoint_name=endpoint.name,
222+
experiment_name="my-batch-job-experiment",
223+
inputs={
224+
"heart_dataset": Input("https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data"),
225+
}
226+
)
227+
```
228+
229+
# [REST](#tab/rest)
230+
231+
Use the key `experimentName` in `properties` section to indicate the experiment name:
232+
233+
__Body__
234+
235+
```json
236+
{
237+
"properties": {
238+
"InputData": {
239+
"heart_dataset": {
240+
"JobInputType" : "UriFolder",
241+
"Uri": "https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data"
242+
}
243+
},
244+
"properties":
245+
{
246+
"experimentName": "my-batch-job-experiment"
247+
}
248+
}
249+
}
250+
```
251+
252+
__Request__
253+
254+
```http
255+
POST jobs HTTP/1.1
256+
Host: <ENDPOINT_URI>
257+
Authorization: Bearer <TOKEN>
258+
Content-Type: application/json
259+
```
260+
---
84261

85262
## Understanding inputs and outputs
86263

@@ -782,111 +959,6 @@ The following example shows how to change the location where an output named `sc
782959
Content-Type: application/json
783960
```
784961

785-
## Invoke a specific deployment
786-
787-
Batch endpoints can host multiple deployments under the same endpoint. The default endpoint is used unless the user specifies otherwise. You can change the deployment that is used as follows:
788-
789-
# [Azure CLI](#tab/cli)
790-
791-
Use the argument `--deployment-name` or `-d` to specify the name of the deployment:
792-
793-
```azurecli
794-
az ml batch-endpoint invoke --name $ENDPOINT_NAME --deployment-name $DEPLOYMENT_NAME --input $INPUT_DATA
795-
```
796-
797-
# [Python](#tab/sdk)
798-
799-
Use the parameter `deployment_name` to specify the name of the deployment:
800-
801-
```python
802-
job = ml_client.batch_endpoints.invoke(
803-
endpoint_name=endpoint.name,
804-
deployment_name=deployment.name,
805-
inputs={
806-
"heart_dataset": input,
807-
}
808-
)
809-
```
810-
811-
# [REST](#tab/rest)
812-
813-
Add the header `azureml-model-deployment` to your request, including the name of the deployment you want to invoke.
814-
815-
__Request__
816-
817-
```http
818-
POST jobs HTTP/1.1
819-
Host: <ENDPOINT_URI>
820-
Authorization: Bearer <TOKEN>
821-
Content-Type: application/json
822-
azureml-model-deployment: DEPLOYMENT_NAME
823-
```
824-
---
825-
826-
## Configure job properties
827-
828-
You can configure some of the properties in the created job at invocation time.
829-
830-
> [!NOTE]
831-
> Configuring job properties is only available in batch endpoints with Pipeline component deployments by the moment.
832-
833-
### Configure experiment name
834-
835-
# [Azure CLI](#tab/cli)
836-
837-
Use the argument `--experiment-name` to specify the name of the experiment:
838-
839-
```azurecli
840-
az ml batch-endpoint invoke --name $ENDPOINT_NAME --experiment-name "my-batch-job-experiment" --input $INPUT_DATA
841-
```
842-
843-
# [Python](#tab/sdk)
844-
845-
Use the parameter `experiment_name` to specify the name of the experiment:
846-
847-
```python
848-
job = ml_client.batch_endpoints.invoke(
849-
endpoint_name=endpoint.name,
850-
experiment_name="my-batch-job-experiment",
851-
inputs={
852-
"heart_dataset": input,
853-
}
854-
)
855-
```
856-
857-
# [REST](#tab/rest)
858-
859-
Use the key `experimentName` in `properties` section to indicate the experiment name:
860-
861-
__Body__
862-
863-
```json
864-
{
865-
"properties": {
866-
"InputData": {
867-
"heart_dataset": {
868-
"JobInputType" : "UriFolder",
869-
"Uri": "https://azuremlexampledata.blob.core.windows.net/data/heart-disease-uci/data"
870-
}
871-
},
872-
"properties":
873-
{
874-
"experimentName": "my-batch-job-experiment"
875-
}
876-
}
877-
}
878-
```
879-
880-
__Request__
881-
882-
```http
883-
POST jobs HTTP/1.1
884-
Host: <ENDPOINT_URI>
885-
Authorization: Bearer <TOKEN>
886-
Content-Type: application/json
887-
```
888-
---
889-
890962

891963
## Next steps
892964

0 commit comments

Comments
 (0)