Skip to content

Commit 1714e73

Browse files
wanyang7harryli0108
authored andcommitted
Run notebook sdk change (Azure#24269)
* run notebook api * fix * fix
1 parent 3b9baa8 commit 1714e73

File tree

7 files changed

+986
-1
lines changed

7 files changed

+986
-1
lines changed

custom-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ querypool
17241724
querystring
17251725
querytriggers
17261726
queueservices
1727+
Queueable
17271728
QueueStatus
17281729
quickbooks
17291730
quicktest
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"parameters": {
3+
"endpoint": "exampleWorkspace.dev.azuresynapse.net",
4+
"api-version": "2022-03-01-preview",
5+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373"
6+
},
7+
"responses": {
8+
"200": {
9+
"headers": {
10+
"Date": "Wed, 10 Mar 2021 07:24:29 GMT",
11+
"Server": "Kestrel Microsoft-HTTPAPI/2.0",
12+
"Transfer-Encoding": "chunked",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"x-ms-request-id": "393b45f1-a176-4e74-accd-5f66d7f81ec6"
15+
},
16+
"body": {
17+
"message": "Cancelled the notebook run - 4b200abf-c90c-43cf-98ae-b9f2bcf90373",
18+
"result": {
19+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
20+
"runStatus": "Cancelled",
21+
"sessionId": -1,
22+
"sparkPool": "exampleSparkpool",
23+
"lastCheckedOn": "0001-01-01T00:00:00"
24+
}
25+
}
26+
},
27+
"409": {
28+
"headers": {
29+
"Date": "Wed, 10 Mar 2021 07:24:29 GMT",
30+
"Server": "Kestrel Microsoft-HTTPAPI/2.0",
31+
"Transfer-Encoding": "chunked",
32+
"Content-Type": "application/json; charset=utf-8",
33+
"x-ms-request-id": "393b45f1-a176-4e74-accd-5f66d7f81ec6"
34+
},
35+
"body": {
36+
"message": "Notebook execution is in SnapshotTaken state and cannot accept the cancel request. Retry after sometime.",
37+
"result": {
38+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
39+
"runStatus": "SnapshotTaken",
40+
"sessionId": -1,
41+
"sparkPool": "exampleSparkpool"
42+
}
43+
}
44+
}
45+
}
46+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"endpoint": "exampleWorkspace.dev.azuresynapse.net",
4+
"api-version": "2022-03-01-preview",
5+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
6+
"RunNotebookRequest": {
7+
"sparkPool": "exampleSparkpool",
8+
"notebook": "exampleNotebook",
9+
"sessionOptions": {
10+
"driverMemory": "28g",
11+
"driverCores": 4,
12+
"executorMemory": "28g",
13+
"executorCores": 4,
14+
"numExecutors": 2
15+
},
16+
"parameters": {
17+
"param1": {
18+
"type": "String",
19+
"value": "param1 value."
20+
},
21+
"param2": {
22+
"type": "String",
23+
"value": "param2 value."
24+
}
25+
}
26+
}
27+
},
28+
"responses": {
29+
"202": {
30+
"headers": {
31+
"Date": "Wed, 10 Mar 2021 07:24:29 GMT",
32+
"Server": "Kestrel Microsoft-HTTPAPI/2.0",
33+
"Transfer-Encoding": "chunked",
34+
"Content-Type": "application/json; charset=utf-8",
35+
"x-ms-request-id": "393b45f1-a176-4e74-accd-5f66d7f81ec6"
36+
},
37+
"body": {
38+
"message": "Request accepted for running the notebook exampleNotebook. Query execution status using 4b200abf-c90c-43cf-98ae-b9f2bcf90373",
39+
"result": {
40+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
41+
"runStatus": "Starting",
42+
"sessionId": -1,
43+
"sparkPool": "exampleSparkpool",
44+
"lastCheckedOn": "0001-01-01T00:00:00"
45+
}
46+
}
47+
}
48+
}
49+
}
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
{
2+
"parameters": {
3+
"endpoint": "exampleWorkspace.dev.azuresynapse.net",
4+
"api-version": "2022-03-01-preview",
5+
"runId": "4b200abf-c90c-43cf-98ae-b9f2bcf90373"
6+
},
7+
"responses": {
8+
"200": {
9+
"headers": {
10+
"Date": "Wed, 10 Mar 2021 07:24:29 GMT",
11+
"Server": "Kestrel Microsoft-HTTPAPI/2.0",
12+
"Transfer-Encoding": "chunked",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"x-ms-request-id": "393b45f1-a176-4e74-accd-5f66d7f81ec6"
15+
},
16+
"body": {
17+
"message": "Notebook execution is in Failed state",
18+
"result": {
19+
"snapshot": {
20+
"id": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
21+
"notebook": "exampleNotebook",
22+
"parameters": {
23+
"param1": {
24+
"type": "String",
25+
"value": "Run"
26+
},
27+
"param2": {
28+
"type": "String",
29+
"value": "Run2"
30+
}
31+
},
32+
"notebookContent": {
33+
"id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleWorkspace/notebooks/exampleNotebook",
34+
"name": "exampleNotebook",
35+
"type": "Microsoft.Synapse/workspaces/notebooks",
36+
"properties": {
37+
"nbformat": 4,
38+
"nbformat_minor": 2,
39+
"bigDataPool": {
40+
"referenceName": "exampleSparkpool",
41+
"type": "BigDataPoolReference"
42+
},
43+
"sessionProperties": {
44+
"driverMemory": "56g",
45+
"driverCores": 8,
46+
"executorMemory": "56g",
47+
"executorCores": 8,
48+
"numExecutors": 2
49+
},
50+
"metadata": {
51+
"language_info": {
52+
"name": "python",
53+
"codemirror_mode": null,
54+
"version": null
55+
},
56+
"a365ComputeOptions": {
57+
"id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleworkspace/bigDataPools/exampleSparkpool",
58+
"name": "exampleSparkpool",
59+
"type": "Spark",
60+
"endpoint": "https://exampleWorkspace.dev.azuresynapse-dogfood.net/livyApi/versions/2019-11-01-preview/sparkPools/exampleSparkpool",
61+
"auth": {
62+
"type": "AAD",
63+
"authResource": "https://dev.azuresynapse.net"
64+
},
65+
"sparkVersion": "2.4",
66+
"nodeCount": 3,
67+
"cores": 8,
68+
"memory": 56,
69+
"extraHeader": null
70+
},
71+
"synapse_widget": {
72+
"version": "0.1",
73+
"state": {}
74+
},
75+
"kernelspec": {
76+
"name": "synapse_pyspark",
77+
"display_name": "python"
78+
}
79+
},
80+
"cells": [
81+
{
82+
"cell_type": "code",
83+
"source": [
84+
"num = 10"
85+
],
86+
"outputs": [
87+
{
88+
"output_type": "display_data",
89+
"data": {
90+
"application/vnd.livy.statement-meta+json": {
91+
"spark_pool": "exampleSparkpool",
92+
"session_id": 1,
93+
"statement_id": 1,
94+
"state": "finished",
95+
"livy_statement_state": "available",
96+
"queued_time": "2021-09-06T10:24:57.6453419Z",
97+
"session_start_time": "2021-09-06T10:24:57.6941584Z",
98+
"execution_start_time": "2021-09-06T10:28:50.1738715Z",
99+
"execution_finish_time": "2021-09-06T10:28:50.1739715Z"
100+
},
101+
"text/plain": "StatementMeta(exampleSparkpool, 1, 1, Finished, Available)"
102+
},
103+
"metadata": {}
104+
},
105+
{
106+
"output_type": "execute_result",
107+
"execution_count": 1,
108+
"data": {
109+
"text/plain": ""
110+
},
111+
"metadata": {}
112+
}
113+
],
114+
"metadata": {
115+
"tags": [
116+
"parameters"
117+
],
118+
"jupyter": {
119+
"source_hidden": false,
120+
"outputs_hidden": false
121+
},
122+
"nteract": {
123+
"transient": {
124+
"deleting": false
125+
}
126+
},
127+
"collapsed": true
128+
}
129+
},
130+
{
131+
"cell_type": "code",
132+
"source": [
133+
"# This cell is generated from runtime parameters. Learn more: https://go.microsoft.com/fwlink/?linkid=2161015\n",
134+
"param1 = \"Run\"\n",
135+
"param2 = \"Run2\"\n"
136+
],
137+
"outputs": [
138+
{
139+
"output_type": "display_data",
140+
"data": {
141+
"application/vnd.livy.statement-meta+json": {
142+
"spark_pool": "exampleSparkpool",
143+
"session_id": 1,
144+
"statement_id": 2,
145+
"state": "finished",
146+
"livy_statement_state": "available",
147+
"queued_time": "2021-09-06T10:24:57.6541813Z",
148+
"session_start_time": null,
149+
"execution_start_time": "2021-09-06T10:28:50.5257245Z",
150+
"execution_finish_time": "2021-09-06T10:28:50.5258235Z"
151+
},
152+
"text/plain": "StatementMeta(exampleSparkpool, 1, 2, Finished, Available)"
153+
},
154+
"metadata": {}
155+
},
156+
{
157+
"output_type": "execute_result",
158+
"execution_count": 2,
159+
"data": {
160+
"text/plain": ""
161+
},
162+
"metadata": {}
163+
}
164+
],
165+
"metadata": {
166+
"tags": [
167+
"parameters_overwritten"
168+
]
169+
}
170+
},
171+
{
172+
"cell_type": "code",
173+
"source": [
174+
"mssparkutils.notebook.exit(\"SUCCESS_exampleNotebook with num is \" + str(num))"
175+
],
176+
"outputs": [
177+
{
178+
"output_type": "display_data",
179+
"data": {
180+
"application/vnd.livy.statement-meta+json": {
181+
"spark_pool": "exampleSparkpool",
182+
"session_id": 1,
183+
"statement_id": 3,
184+
"state": "finished",
185+
"livy_statement_state": "available",
186+
"queued_time": "2021-09-06T10:24:57.6615537Z",
187+
"session_start_time": null,
188+
"execution_start_time": "2021-09-06T10:28:50.8668915Z",
189+
"execution_finish_time": "2021-09-06T10:28:51.2691628Z"
190+
},
191+
"text/plain": "StatementMeta(exampleSparkpool, 1, 3, Finished, Available)"
192+
},
193+
"metadata": {}
194+
},
195+
{
196+
"output_type": "display_data",
197+
"data": {
198+
"text/plain": "ExitValue: SUCCESS_exampleNotebook with num is 10"
199+
},
200+
"metadata": {}
201+
}
202+
],
203+
"metadata": {}
204+
}
205+
],
206+
"folder": null
207+
},
208+
"etag": "0f00eb17-0000-3400-0000-60502a1e0000"
209+
},
210+
"sparkPool": "exampleSparkpool",
211+
"sessionId": null,
212+
"sessionOptions": {
213+
"kind": null,
214+
"proxyUser": null,
215+
"jars": null,
216+
"pyFiles": null,
217+
"files": null,
218+
"driverMemory": "28g",
219+
"driverCores": 4,
220+
"executorMemory": "28g",
221+
"executorCores": 4,
222+
"numExecutors": 2,
223+
"archives": null,
224+
"queue": null,
225+
"name": null,
226+
"conf": null,
227+
"isQueueable": null,
228+
"heartbeatTimeoutInSecond": null
229+
},
230+
"honorSessionTimeToLive": false,
231+
"exitValue": "SUCCESS_exampleNotebook with num is 10"
232+
},
233+
"runId": "e4221395-55ae-4c6d-9756-fae966d84350",
234+
"runStatus": "Succeeded",
235+
"sessionId": 1,
236+
"sparkPool": "exampleSparkpool",
237+
"lastCheckedOn": "0001-01-01T00:00:00"
238+
}
239+
}
240+
}
241+
}
242+
}

0 commit comments

Comments
 (0)