|
37 | 37 | " CodeConfiguration,\n",
|
38 | 38 | " Environment,\n",
|
39 | 39 | ")\n",
|
40 |
| - "from azure.identity import DefaultAzureCredential, AzureCliCredential" |
| 40 | + "from azure.identity import DefaultAzureCredential" |
41 | 41 | ]
|
42 | 42 | },
|
43 | 43 | {
|
|
63 | 63 | },
|
64 | 64 | "outputs": [],
|
65 | 65 | "source": [
|
66 |
| - "credential = AzureCliCredential()\n", |
| 66 | + "credential = DefaultAzureCredential()\n", |
67 | 67 | "ml_client = MLClient(\n",
|
68 | 68 | " credential,\n",
|
69 | 69 | " subscription_id=subscription_id,\n",
|
|
83 | 83 | "deployment = ManagedOnlineDeployment(\n",
|
84 | 84 | " name=\"blue\",\n",
|
85 | 85 | " endpoint_name=endpoint_name,\n",
|
86 |
| - " model=Model(path=\"../model-1/model\"),\n", |
| 86 | + " model=Model(path=\"../model-1/model/sklearn_regression_model.pkl\"),\n", |
87 | 87 | " code_configuration=CodeConfiguration(\n",
|
88 | 88 | " code=\"../model-1/onlinescoring\", scoring_script=\"score.py\"\n",
|
89 | 89 | " ),\n",
|
|
96 | 96 | ")\n",
|
97 | 97 | "\n",
|
98 | 98 | "deployment = ml_client.online_deployments.begin_create_or_update(\n",
|
99 |
| - " deployment,\n", |
100 |
| - " local=True,\n", |
101 |
| - " vscode_debug=True,\n", |
| 99 | + " deployment, local=True, vscode_debug=True\n", |
102 | 100 | ")"
|
103 | 101 | ]
|
104 | 102 | },
|
|
121 | 119 | "\n",
|
122 | 120 | "request_file_path = \"../model-1/sample-request.json\"\n",
|
123 | 121 | "\n",
|
124 |
| - "endpoint.invoke(endpoint_name, request_file_path, local=True)" |
| 122 | + "ml_client.online_endpoints.invoke(endpoint_name, request_file_path, local=True)" |
125 | 123 | ]
|
126 | 124 | },
|
127 | 125 | {
|
|
132 | 130 | },
|
133 | 131 | "outputs": [],
|
134 | 132 | "source": [
|
135 |
| - "endpoint = ml_client.online_endpoints.get(endpoint_name, local=True)\n", |
136 |
| - "endpoint.as_dict()" |
| 133 | + "print(endpoint)" |
137 | 134 | ]
|
138 | 135 | },
|
139 | 136 | {
|
|
154 | 151 | "new_deployment = ManagedOnlineDeployment(\n",
|
155 | 152 | " name=\"green\",\n",
|
156 | 153 | " endpoint_name=endpoint_name,\n",
|
157 |
| - " model=Model(path=\"../model-2/model\"),\n", |
| 154 | + " model=Model(path=\"../model-2/model/sklearn_regression_model.pkl\"),\n", |
158 | 155 | " code_configuration=CodeConfiguration(\n",
|
159 | 156 | " code=\"../model-2/onlinescoring\", scoring_script=\"score.py\"\n",
|
160 | 157 | " ),\n",
|
161 | 158 | " environment=Environment(\n",
|
162 |
| - " conda_file=\"../model-1/environment/conda.yml\",\n", |
| 159 | + " conda_file=\"../model-2/environment/conda.yml\",\n", |
163 | 160 | " image=\"mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1\",\n",
|
164 | 161 | " ),\n",
|
165 | 162 | " instance_type=\"Standard_DS2_v2\",\n",
|
166 | 163 | " instance_count=2,\n",
|
167 | 164 | ")\n",
|
168 | 165 | "\n",
|
169 |
| - "\n", |
170 |
| - "ml_client.online_deployments.begin_create_or_update(\n", |
| 166 | + "deployment = ml_client.online_deployments.begin_create_or_update(\n", |
171 | 167 | " new_deployment, local=True, vscode_debug=True\n",
|
172 | 168 | ")"
|
173 | 169 | ]
|
|
0 commit comments