Skip to content

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
shirasassoon:add_jobinstance_id_to_json_return
Open

feat: Include job instance ID as structured data in job run/job start JSON output#232
shirasassoon wants to merge 5 commits intomicrosoft:mainfrom
shirasassoon:add_jobinstance_id_to_json_return

Conversation

@shirasassoon
Copy link
Copy Markdown
Contributor

📥 Pull Request

Adds a data field with the job instance ID to the JSON output of job run and job start commands. Previously, the ID was only embedded in the human-readable message string, making it difficult to extract programmatically.

Changes

  • Added data={"id": <job_instance_id>} to print_output_format calls in fab_jobs_run.py (job created, job cancelled on timeout) and fab_cmd_job_utils.py (job completed)
  • Fixed import ordering in fab_cmd_job_utils.py

JSON output before

{"result": {"message": "Job instance '<id>' created"}}

Copilot AI review requested due to automatic review settings May 6, 2026 13:58
@shirasassoon shirasassoon requested a review from a team as a code owner May 6, 2026 13:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>} to print_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 thread src/fabric_cli/utils/fab_cmd_job_utils.py Outdated
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 thread src/fabric_cli/commands/jobs/fab_jobs_run.py Outdated
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}
)
Copilot AI review requested due to automatic review settings May 6, 2026 14:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

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}
)
fix
Co-authored-by: Copilot <copilot@github.com>
Comment thread src/fabric_cli/commands/jobs/fab_jobs_run.py Outdated
Comment thread src/fabric_cli/commands/jobs/fab_jobs_run.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_job_utils.py Outdated
Copilot AI review requested due to automatic review settings May 7, 2026 12:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

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
Comment thread src/fabric_cli/utils/fab_cmd_job_utils.py Outdated
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
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants