feat: Include job instance ID as structured data in job run/job start JSON output#232
Open
shirasassoon wants to merge 5 commits intomicrosoft:mainfrom
Open
feat: Include job instance ID as structured data in job run/job start JSON output#232shirasassoon wants to merge 5 commits intomicrosoft:mainfrom
job run/job start JSON output#232shirasassoon wants to merge 5 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the CLI’s machine-readability by including the job instance ID as structured output data when job run / job start emit JSON, instead of embedding the ID only inside human-readable message strings.
Changes:
- Add
data={"id": <job_instance_id>}toprint_output_format(...)for job creation, completion, and async cancellation-on-timeout paths. - Minor import reordering/spacing in
fab_cmd_job_utils.py.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/fabric_cli/utils/fab_cmd_job_utils.py |
Adds job instance id to structured output on “Completed” status; adjusts import spacing/order. |
src/fabric_cli/commands/jobs/fab_jobs_run.py |
Adds job instance id to structured output for “created” and “cancelled (async)” messages. |
Comment on lines
96
to
99
| if status == "Completed": | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_ins_id}' completed" | ||
| args, message=f"Job instance '{job_ins_id}' completed", data={"id": job_ins_id} | ||
| ) |
Comment on lines
54
to
63
| fab_ui.print_output_format( | ||
| args, | ||
| message=f"Job instance '{args.instance_id}' cancelled (async)", | ||
| data={"id": args.instance_id}, | ||
| ) | ||
|
|
||
| else: | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_instance_id}' created" | ||
| args, message=f"Job instance '{job_instance_id}' created", data={"id": job_instance_id} | ||
| ) |
Comment on lines
60
to
63
| else: | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_instance_id}' created" | ||
| args, message=f"Job instance '{job_instance_id}' created", data={"id": job_instance_id} | ||
| ) |
Comment on lines
96
to
99
| if status == "Completed": | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_ins_id}' completed" | ||
| args, message=f"Job instance '{job_ins_id}' completed", data={"id": job_ins_id} | ||
| ) |
Comment on lines
54
to
58
| fab_ui.print_output_format( | ||
| args, | ||
| message=f"Job instance '{args.instance_id}' cancelled (async)", | ||
| data={"id": args.instance_id}, | ||
| ) |
Comment on lines
60
to
63
| else: | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_instance_id}' created" | ||
| args, message=f"Job instance '{job_instance_id}' created", data={"id": job_instance_id} | ||
| ) |
aviatco
reviewed
May 7, 2026
aviatco
reviewed
May 7, 2026
aviatco
reviewed
May 7, 2026
| from fabric_cli.client import fab_api_jobs as jobs_api | ||
| from fabric_cli.client.fab_api_types import ApiResponse | ||
| from fabric_cli.core import fab_constant, fab_logger | ||
| from fabric_cli.core import fab_constant, fab_logger, fab_state_config |
| else: | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_instance_id}' created" | ||
| args, message=f"Job instance '{job_instance_id}' created", data={"id": job_instance_id}, show_key_value_list=True |
Comment on lines
54
to
64
| fab_ui.print_output_format( | ||
| args, | ||
| message=f"Job instance '{args.instance_id}' cancelled (async)", | ||
| data={"id": args.instance_id}, | ||
| show_key_value_list=True, | ||
| ) | ||
|
|
||
| else: | ||
| fab_ui.print_output_format( | ||
| args, message=f"Job instance '{job_instance_id}' created" | ||
| args, message=f"Job instance '{job_instance_id}' created", data={"id": job_instance_id}, show_key_value_list=True | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
Adds a
datafield with the job instance ID to the JSON output ofjob runandjob startcommands. Previously, the ID was only embedded in the human-readable message string, making it difficult to extract programmatically.Changes
data={"id": <job_instance_id>}toprint_output_formatcalls infab_jobs_run.py(job created, job cancelled on timeout) andfab_cmd_job_utils.py(job completed)fab_cmd_job_utils.pyJSON output before
{"result": {"message": "Job instance '<id>' created"}}