From 308f4b29df349ab674dd03262c0bef438178ffce Mon Sep 17 00:00:00 2001 From: Alon Yeshurun Date: Wed, 23 Sep 2026 16:07:33 +0300 Subject: [PATCH] fix: use job type path for on-demand runs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .changes/unreleased/fixed-20260923-160500.yaml | 6 ++++++ src/fabric_cli/client/fab_api_jobs.py | 7 +++++-- .../test_jobs/test_job_run_exits_with_code_1_success.yaml | 2 +- ...run_failure_with_timeout_exits_with_code_1_success.yaml | 2 +- ...t_job_run_json_output_contains_instance_id_success.yaml | 2 +- ...t_job_run_text_output_contains_instance_id_success.yaml | 2 +- ...cancelled_json_output_contains_instance_id_success.yaml | 2 +- ...cancelled_text_output_contains_instance_id_success.yaml | 2 +- ...job_start_json_output_contains_instance_id_success.yaml | 2 +- ...job_start_text_output_contains_instance_id_success.yaml | 2 +- .../test_commands/test_jobs/test_run_job_notebook.yaml | 2 +- .../test_jobs/test_run_job_notebook_timeout.yaml | 2 +- .../test_jobs/test_run_job_notebook_timeout_zero_sec.yaml | 2 +- .../test_commands/test_jobs/test_run_param_job.yaml | 4 ++-- .../test_commands/test_jobs/test_run_pipeline.yaml | 2 +- .../test_commands/test_jobs/test_run_spark_job.yaml | 2 +- .../test_jobs/test_run_table_maintenance.yaml | 4 ++-- .../test_jobs/test_start_job_notebook_and_cancel.yaml | 2 +- 18 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 .changes/unreleased/fixed-20260923-160500.yaml diff --git a/.changes/unreleased/fixed-20260923-160500.yaml b/.changes/unreleased/fixed-20260923-160500.yaml new file mode 100644 index 000000000..d8aaffd87 --- /dev/null +++ b/.changes/unreleased/fixed-20260923-160500.yaml @@ -0,0 +1,6 @@ +kind: fixed +body: Update on-demand job runs to use the job type path format +time: 2026-09-23T16:05:00.000000000+03:00 +custom: + Author: ayeshurun + AuthorLink: https://github.com/ayeshurun diff --git a/src/fabric_cli/client/fab_api_jobs.py b/src/fabric_cli/client/fab_api_jobs.py index a333bf53d..eaebf8dee 100644 --- a/src/fabric_cli/client/fab_api_jobs.py +++ b/src/fabric_cli/client/fab_api_jobs.py @@ -12,7 +12,9 @@ def run_on_demand_item_job( args: Namespace, payload: Optional[str] = None ) -> tuple[ApiResponse, Any]: """https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/run-on-demand-item-job?tabs=HTTP""" - args.uri = f"workspaces/{args.ws_id}/items/{args.item_id}/jobs/instances?jobType={args.jobType}" + args.uri = ( + f"workspaces/{args.ws_id}/items/{args.item_id}/jobs/{args.jobType}/instances" + ) args.method = "post" if payload is not None: @@ -90,9 +92,10 @@ def list_item_runs(args: Namespace) -> ApiResponse: return fabric_api.do_request(args) + def remove_item_schedule(args: Namespace) -> ApiResponse: """https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/delete-item-schedule?tabs=HTTP""" args.uri = f"workspaces/{args.ws_id}/items/{args.item_id}/jobs/{args.jobType}/schedules/{args.schedule_id}" args.method = "delete" - return fabric_api.do_request(args) \ No newline at end of file + return fabric_api.do_request(args) diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml index f2e9155ec..ce40f52c6 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/dd3a31c2-ad84-4378-a99c-f69de0df1928/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/dd3a31c2-ad84-4378-a99c-f69de0df1928/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml index 4cbd51742..1f5c72386 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/9b28919f-4d45-46c1-ae1f-e4211d250ca5/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/9b28919f-4d45-46c1-ae1f-e4211d250ca5/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_json_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_json_output_contains_instance_id_success.yaml index 78244eb62..0c1b08b3b 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_json_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_json_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/8047ac4b-336a-46ad-a27d-8883d9d7d43c/items/4299225f-8c77-4563-9e3a-3cbbc2013bee/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/8047ac4b-336a-46ad-a27d-8883d9d7d43c/items/4299225f-8c77-4563-9e3a-3cbbc2013bee/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_text_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_text_output_contains_instance_id_success.yaml index 112e6ab31..e448e924d 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_text_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_text_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/abdcbea8-1347-47c9-8d20-5f396c53f804/items/76960590-c6c4-4a2b-9cdf-17ec4cd4bf10/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/abdcbea8-1347-47c9-8d20-5f396c53f804/items/76960590-c6c4-4a2b-9cdf-17ec4cd4bf10/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_json_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_json_output_contains_instance_id_success.yaml index 5fa500fe2..91254d9e5 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_json_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_json_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/901207b1-1c1d-4725-b968-a71d17b7f187/items/59812be5-b5b7-433a-9329-e8868b60f2dc/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/901207b1-1c1d-4725-b968-a71d17b7f187/items/59812be5-b5b7-433a-9329-e8868b60f2dc/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_text_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_text_output_contains_instance_id_success.yaml index 230b293ff..ff40f81da 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_text_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_timeout_cancelled_text_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/3469b96e-2a66-4e82-95dc-ccc12fa33156/items/c42c2b64-bfad-4247-ac67-4a4c7332b3c2/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/3469b96e-2a66-4e82-95dc-ccc12fa33156/items/c42c2b64-bfad-4247-ac67-4a4c7332b3c2/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_json_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_json_output_contains_instance_id_success.yaml index d7fa00690..fb32473ad 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_json_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_json_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/080e8ff9-e225-4800-8078-8b945ec93a0e/items/833214fe-32f1-4f93-845a-f2c64a3592a3/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/080e8ff9-e225-4800-8078-8b945ec93a0e/items/833214fe-32f1-4f93-845a-f2c64a3592a3/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_text_output_contains_instance_id_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_text_output_contains_instance_id_success.yaml index 66a2f6064..1affd0604 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_text_output_contains_instance_id_success.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_start_text_output_contains_instance_id_success.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/54fb4165-28c2-409f-898d-8287474d828c/items/5c707c59-1f42-427a-9108-d80ba71693a7/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/54fb4165-28c2-409f-898d-8287474d828c/items/5c707c59-1f42-427a-9108-d80ba71693a7/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook.yaml index 392c643bc..a5ddc5382 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/084a0b36-3e39-475d-a5fa-c53156358982/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/084a0b36-3e39-475d-a5fa-c53156358982/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout.yaml index 26b25d230..a3397c6cb 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout.yaml @@ -416,7 +416,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.1.0.rc2 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items/ecbc6807-4832-45e8-8d22-d5ed9d75c96a/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items/ecbc6807-4832-45e8-8d22-d5ed9d75c96a/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout_zero_sec.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout_zero_sec.yaml index 2ac89aa30..59bb3912e 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout_zero_sec.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout_zero_sec.yaml @@ -421,7 +421,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/27726768-dbaf-4550-a115-68690e83addd/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/27726768-dbaf-4550-a115-68690e83addd/jobs/RunNotebook/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_param_job.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_param_job.yaml index 886c2e2a7..708bb3126 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_param_job.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_param_job.yaml @@ -727,7 +727,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/9da35c17-eb13-4ff0-b9c6-757d8a3e7c36/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/9da35c17-eb13-4ff0-b9c6-757d8a3e7c36/jobs/RunNotebook/instances response: body: string: '' @@ -1257,7 +1257,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/c7995b9d-2c5e-45c9-a948-d22df6f17086/jobs/instances?jobType=Pipeline + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/c7995b9d-2c5e-45c9-a948-d22df6f17086/jobs/Pipeline/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_pipeline.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_pipeline.yaml index 0d9f7bd28..00276d8e5 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_pipeline.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_pipeline.yaml @@ -1044,7 +1044,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/40facc38-1a01-4259-844c-4e51755577a7/jobs/instances?jobType=Pipeline + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/40facc38-1a01-4259-844c-4e51755577a7/jobs/Pipeline/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_spark_job.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_spark_job.yaml index d5f3f00b0..a17b55426 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_spark_job.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_spark_job.yaml @@ -1311,7 +1311,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.1 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/34edd45c-a25b-4158-8329-f12e29fc6c08/items/82139ce8-e396-487b-b219-d5309fe52f6c/jobs/instances?jobType=sparkjob + uri: https://api.fabric.microsoft.com/v1/workspaces/34edd45c-a25b-4158-8329-f12e29fc6c08/items/82139ce8-e396-487b-b219-d5309fe52f6c/jobs/sparkjob/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_run_table_maintenance.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_run_table_maintenance.yaml index d6418e5c1..08c182503 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_run_table_maintenance.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_run_table_maintenance.yaml @@ -1236,7 +1236,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/7b83f57c-6728-4352-be26-0306a6a55344/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/7b83f57c-6728-4352-be26-0306a6a55344/jobs/RunNotebook/instances response: body: string: '' @@ -2127,7 +2127,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.6.0 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/f2cbae5b-8b8c-4c1e-b63c-2d27fccb11e6/jobs/instances?jobType=TableMaintenance + uri: https://api.fabric.microsoft.com/v1/workspaces/efeaa2e0-49e1-48cb-b22b-6b7edaaf8968/items/f2cbae5b-8b8c-4c1e-b63c-2d27fccb11e6/jobs/TableMaintenance/instances response: body: string: '' diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_start_job_notebook_and_cancel.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_start_job_notebook_and_cancel.yaml index 3a48a4501..8a1741361 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/test_start_job_notebook_and_cancel.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_start_job_notebook_and_cancel.yaml @@ -416,7 +416,7 @@ interactions: User-Agent: - ms-fabric-cli-test/1.1.0.rc2 method: POST - uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items/090aeedc-1c66-4e70-bebe-01df1101fcf0/jobs/instances?jobType=RunNotebook + uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items/090aeedc-1c66-4e70-bebe-01df1101fcf0/jobs/RunNotebook/instances response: body: string: ''