Skip to content

Commit 133f264

Browse files
aviatcoAviat Cohen
andauthored
fix: job run command exits with status code 1 on failure. (#134)
Co-authored-by: Aviat Cohen <aviatcohen@microsoft.com>
1 parent 50f8620 commit 133f264

9 files changed

Lines changed: 1502 additions & 50 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: fixed
2+
body: Fix the job run command so that it exits with status code 1 on failure.
3+
time: 2026-01-12T14:35:53.325666256Z
4+
custom:
5+
Author: aviatco
6+
AuthorLink: https://github.com/aviatco

‎src/fabric_cli/utils/fab_cmd_job_utils.py‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,11 @@ def wait_for_job_completion(
102102
)
103103
return
104104
elif status == "Failed":
105-
fab_ui.print_output_error(
106-
FabricCLIError(
105+
fab_ui.print_entries_unix_style([content], content.keys(), header=True)
106+
raise FabricCLIError(
107107
ErrorMessages.Common.job_instance_failed(job_ins_id),
108108
fab_constant.ERROR_JOB_FAILED,
109-
),
110-
command=args.command,
111-
output_format_type=args.output_format,
112-
)
113-
fab_ui.print_entries_unix_style([content], content.keys(), header=True)
114-
return
109+
)
115110
elif status in ["NotStarted", "InProgress"]:
116111
fab_ui.print_progress(f"Job instance status: {status}")
117112

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/fabric/gitIntegration/platformProperties/2.0.0/schema.json",
3+
"metadata": {
4+
"type": "Notebook",
5+
"displayName": "example_failed",
6+
"description": "Created by fab - designed to fail for testing"
7+
},
8+
"config": {
9+
"version": "2.0",
10+
"logicalId": "00000000-0000-0000-0000-000000000000"
11+
}
12+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"microsoft": {
8+
"language": "python",
9+
"language_group": "synapse_pyspark"
10+
}
11+
},
12+
"outputs": [],
13+
"source": [
14+
"# This notebook is designed to fail for testing purposes\n",
15+
"import sys\n",
16+
"from time import sleep\n",
17+
"\n",
18+
"print('Starting notebook execution...')\n",
19+
"sleep(2)\n",
20+
"\n",
21+
"# Intentionally cause a failure\n",
22+
"raise Exception('Intentional failure for testing job failure scenarios')\n",
23+
"\n",
24+
"# This code should never be reached\n",
25+
"print('This should never execute')"
26+
]
27+
}
28+
],
29+
"metadata": {
30+
"dependencies": {},
31+
"kernel_info": {
32+
"name": "synapse_pyspark"
33+
},
34+
"kernelspec": {
35+
"display_name": "synapse_pyspark",
36+
"name": "synapse_pyspark"
37+
},
38+
"language_info": {
39+
"name": "python"
40+
},
41+
"microsoft": {
42+
"language": "python",
43+
"language_group": "synapse_pyspark",
44+
"ms_spell_check": {
45+
"ms_spell_check_language": "en"
46+
}
47+
},
48+
"nteract": {
49+
"version": "nteract-front-end@1.0.0"
50+
},
51+
"spark_compute": {
52+
"compute_id": "/trident/default",
53+
"session_options": {
54+
"conf": {
55+
"spark.synapse.nbs.session.timeout": "1200000"
56+
}
57+
}
58+
}
59+
},
60+
"nbformat": 4,
61+
"nbformat_minor": 5
62+
}

‎tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml‎

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ interactions:
1111
Content-Type:
1212
- application/json
1313
User-Agent:
14-
- ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
14+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
1515
method: GET
1616
uri: https://api.fabric.microsoft.com/v1/workspaces
1717
response:
1818
body:
19-
string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName":
19+
string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName":
2020
"My workspace", "description": "", "type": "Personal"}]}'
2121
headers:
2222
Access-Control-Expose-Headers:
@@ -26,23 +26,23 @@ interactions:
2626
Content-Encoding:
2727
- gzip
2828
Content-Length:
29-
- '466'
29+
- '2232'
3030
Content-Type:
3131
- application/json; charset=utf-8
3232
Date:
33-
- Sun, 07 Sep 2025 14:56:16 GMT
33+
- Mon, 19 Jan 2026 13:12:34 GMT
3434
Pragma:
3535
- no-cache
3636
RequestId:
37-
- 44867d1e-b196-408d-a59d-853099d12386
37+
- 4e2c0cb4-ed18-4096-b87b-957a3cbc8192
3838
Strict-Transport-Security:
3939
- max-age=31536000; includeSubDomains
4040
X-Content-Type-Options:
4141
- nosniff
4242
X-Frame-Options:
4343
- deny
4444
home-cluster-uri:
45-
- https://wabi-west-europe-redirect.analysis.windows.net/
45+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
4646
request-redirected:
4747
- 'true'
4848
status:
@@ -60,12 +60,12 @@ interactions:
6060
Content-Type:
6161
- application/json
6262
User-Agent:
63-
- ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
63+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
6464
method: GET
6565
uri: https://api.fabric.microsoft.com/v1/workspaces
6666
response:
6767
body:
68-
string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName":
68+
string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName":
6969
"My workspace", "description": "", "type": "Personal"}]}'
7070
headers:
7171
Access-Control-Expose-Headers:
@@ -75,23 +75,23 @@ interactions:
7575
Content-Encoding:
7676
- gzip
7777
Content-Length:
78-
- '466'
78+
- '2232'
7979
Content-Type:
8080
- application/json; charset=utf-8
8181
Date:
82-
- Sun, 07 Sep 2025 14:56:17 GMT
82+
- Mon, 19 Jan 2026 13:12:34 GMT
8383
Pragma:
8484
- no-cache
8585
RequestId:
86-
- b950f45e-3ecd-4ffe-9bd0-8f2bcc83fab1
86+
- 62d5a5a6-f18d-4f82-afb1-1b25b2db2f37
8787
Strict-Transport-Security:
8888
- max-age=31536000; includeSubDomains
8989
X-Content-Type-Options:
9090
- nosniff
9191
X-Frame-Options:
9292
- deny
9393
home-cluster-uri:
94-
- https://wabi-west-europe-redirect.analysis.windows.net/
94+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
9595
request-redirected:
9696
- 'true'
9797
status:
@@ -109,13 +109,13 @@ interactions:
109109
Content-Type:
110110
- application/json
111111
User-Agent:
112-
- ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
112+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
113113
method: GET
114114
uri: https://api.fabric.microsoft.com/v1/capacities
115115
response:
116116
body:
117117
string: '{"value": [{"id": "00000000-0000-0000-0000-000000000004", "displayName":
118-
"mocked_fabriccli_capacity_name", "sku": "F16", "region": "West Europe", "state":
118+
"mocked_fabriccli_capacity_name", "sku": "F32", "region": "Central US", "state":
119119
"Active"}]}'
120120
headers:
121121
Access-Control-Expose-Headers:
@@ -125,23 +125,23 @@ interactions:
125125
Content-Encoding:
126126
- gzip
127127
Content-Length:
128-
- '456'
128+
- '425'
129129
Content-Type:
130130
- application/json; charset=utf-8
131131
Date:
132-
- Sun, 07 Sep 2025 14:56:23 GMT
132+
- Mon, 19 Jan 2026 13:12:40 GMT
133133
Pragma:
134134
- no-cache
135135
RequestId:
136-
- 88b1f9a5-c429-4332-a6e0-de57280898d2
136+
- a5664de8-11d6-4182-b695-4db555cb2919
137137
Strict-Transport-Security:
138138
- max-age=31536000; includeSubDomains
139139
X-Content-Type-Options:
140140
- nosniff
141141
X-Frame-Options:
142142
- deny
143143
home-cluster-uri:
144-
- https://wabi-west-europe-redirect.analysis.windows.net/
144+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
145145
request-redirected:
146146
- 'true'
147147
status:
@@ -162,12 +162,12 @@ interactions:
162162
Content-Type:
163163
- application/json
164164
User-Agent:
165-
- ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
165+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
166166
method: POST
167167
uri: https://api.fabric.microsoft.com/v1/workspaces
168168
response:
169169
body:
170-
string: '{"id": "ab04aa79-51eb-45b8-8fa6-c96d985f33e7", "displayName": "fabriccli_WorkspacePerTestclass_000001",
170+
string: '{"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", "displayName": "fabriccli_WorkspacePerTestclass_000001",
171171
"description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}'
172172
headers:
173173
Access-Control-Expose-Headers:
@@ -181,21 +181,21 @@ interactions:
181181
Content-Type:
182182
- application/json; charset=utf-8
183183
Date:
184-
- Sun, 07 Sep 2025 14:56:32 GMT
184+
- Mon, 19 Jan 2026 13:12:46 GMT
185185
Location:
186-
- https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7
186+
- https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437
187187
Pragma:
188188
- no-cache
189189
RequestId:
190-
- 31dc3411-4e07-40c6-9e1b-39aef1d3d5b8
190+
- 2e49777f-790b-4976-9f30-93fe6d4506a9
191191
Strict-Transport-Security:
192192
- max-age=31536000; includeSubDomains
193193
X-Content-Type-Options:
194194
- nosniff
195195
X-Frame-Options:
196196
- deny
197197
home-cluster-uri:
198-
- https://wabi-west-europe-redirect.analysis.windows.net/
198+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
199199
request-redirected:
200200
- 'true'
201201
status:
@@ -213,13 +213,13 @@ interactions:
213213
Content-Type:
214214
- application/json
215215
User-Agent:
216-
- ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
216+
- ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
217217
method: GET
218218
uri: https://api.fabric.microsoft.com/v1/workspaces
219219
response:
220220
body:
221-
string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName":
222-
"My workspace", "description": "", "type": "Personal"}, {"id": "ab04aa79-51eb-45b8-8fa6-c96d985f33e7",
221+
string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName":
222+
"My workspace", "description": "", "type": "Personal"}, {"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437",
223223
"displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created
224224
by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}'
225225
headers:
@@ -230,23 +230,23 @@ interactions:
230230
Content-Encoding:
231231
- gzip
232232
Content-Length:
233-
- '498'
233+
- '2266'
234234
Content-Type:
235235
- application/json; charset=utf-8
236236
Date:
237-
- Sun, 07 Sep 2025 15:19:47 GMT
237+
- Mon, 19 Jan 2026 13:14:01 GMT
238238
Pragma:
239239
- no-cache
240240
RequestId:
241-
- ab18667e-4ac1-4f63-af69-69c038a4bea0
241+
- 6573ea3c-6d46-4903-8c4d-26b5a8d933ae
242242
Strict-Transport-Security:
243243
- max-age=31536000; includeSubDomains
244244
X-Content-Type-Options:
245245
- nosniff
246246
X-Frame-Options:
247247
- deny
248248
home-cluster-uri:
249-
- https://wabi-west-europe-redirect.analysis.windows.net/
249+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
250250
request-redirected:
251251
- 'true'
252252
status:
@@ -264,9 +264,9 @@ interactions:
264264
Content-Type:
265265
- application/json
266266
User-Agent:
267-
- ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
267+
- ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
268268
method: GET
269-
uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items
269+
uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items
270270
response:
271271
body:
272272
string: '{"value": []}'
@@ -282,19 +282,19 @@ interactions:
282282
Content-Type:
283283
- application/json; charset=utf-8
284284
Date:
285-
- Sun, 07 Sep 2025 15:19:47 GMT
285+
- Mon, 19 Jan 2026 13:14:01 GMT
286286
Pragma:
287287
- no-cache
288288
RequestId:
289-
- afd4579c-aa01-4f03-a8fe-a6c0cf1c64d8
289+
- a8d40339-290e-4252-993e-606957f6c9a7
290290
Strict-Transport-Security:
291291
- max-age=31536000; includeSubDomains
292292
X-Content-Type-Options:
293293
- nosniff
294294
X-Frame-Options:
295295
- deny
296296
home-cluster-uri:
297-
- https://wabi-west-europe-redirect.analysis.windows.net/
297+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
298298
request-redirected:
299299
- 'true'
300300
status:
@@ -314,9 +314,9 @@ interactions:
314314
Content-Type:
315315
- application/json
316316
User-Agent:
317-
- ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
317+
- ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
318318
method: DELETE
319-
uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7
319+
uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437
320320
response:
321321
body:
322322
string: ''
@@ -332,19 +332,19 @@ interactions:
332332
Content-Type:
333333
- application/octet-stream
334334
Date:
335-
- Sun, 07 Sep 2025 15:19:47 GMT
335+
- Mon, 19 Jan 2026 13:14:02 GMT
336336
Pragma:
337337
- no-cache
338338
RequestId:
339-
- 4fbb4a9c-fec8-4c41-bd0b-6df06126cb8b
339+
- 4e1f295c-c70b-4ed2-9eb0-33a1e04f30cd
340340
Strict-Transport-Security:
341341
- max-age=31536000; includeSubDomains
342342
X-Content-Type-Options:
343343
- nosniff
344344
X-Frame-Options:
345345
- deny
346346
home-cluster-uri:
347-
- https://wabi-west-europe-redirect.analysis.windows.net/
347+
- https://wabi-us-central-b-primary-redirect.analysis.windows.net/
348348
request-redirected:
349349
- 'true'
350350
status:

0 commit comments

Comments
 (0)