feat: Include job instance ID as structured data in job run/job start JSON output#232
feat: Include job instance ID as structured data in job run/job start JSON output#232shirasassoon wants to merge 15 commits into
job run/job start JSON output#232Conversation
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. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
|
||
| # Build url | ||
| url = f"https://{url}/{uri}" | ||
| url = f"https://{url}/{uri.lstrip('/')}" |
There was a problem hiding this comment.
how does this change is related?
There was a problem hiding this comment.
It's not related. It's a fix for the tests that were failing, however, it may be removed once I redo the testing.
| args.instance_id = job_instance_id | ||
| response = jobs_api.cancel_item_job_instance(args) | ||
| if response.status_code == 202: | ||
| fab_ui.print_grey("") |
There was a problem hiding this comment.
why do you print empty string before each print_output_format?
| fab_ui.print_output_format( | ||
| args, | ||
| message=f"Job instance '{args.instance_id}' cancelled (async)", | ||
| data={"id": args.instance_id}, |
There was a problem hiding this comment.
Can you please add to PR summary screenshot of after?
📥 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"}}