Skip to content

Conversation

@zancheema
Copy link

Closes #8336

Cancelling jobs by ID's will show job names along with each ID in confirmation message. This will let user know if they are cancelling the correct job(s).

Example

Given Command: sky jobs cancel 13 15
Confirmation Message: Cancelling 'Train Model o2' [13], 'Deploy Model o1' [15]. Proceed?

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

@Michaelvll Please review when you find time.
Thanks

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zancheema, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a user experience improvement for the sky jobs cancel command. Previously, cancelling jobs by ID would only show the IDs in the confirmation message. With this change, the system now fetches and displays the corresponding job names along with their IDs, making the confirmation prompt more informative and user-friendly. This ensures that users can easily confirm they are targeting the intended jobs for cancellation.

Highlights

  • Enhanced Job Cancellation Confirmation: The sky jobs cancel command now displays job names alongside their IDs in the confirmation message, providing clearer context to users before they proceed with cancellation.
  • Improved User Experience: This change helps users verify they are cancelling the correct jobs, reducing potential errors and increasing confidence in the operation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the sky jobs cancel command by displaying job names in the confirmation message, which is a great UX improvement. The implementation correctly fetches job names for the provided IDs. I've suggested a minor refinement to also handle cases where some job IDs might be invalid, ensuring the confirmation prompt is as accurate as possible for the user.

Comment on lines +2534 to +2541
names = [
f'{r.get("job_name")!r} [{r.get("job_id")}]'
for r in job_records
]
if names:
jobs_str = ', '.join(map(str, names))
else:
jobs_str = ', '.join(map(str, jobs))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation for fetching job names doesn't handle cases where some provided job IDs are valid and others are not. If a user provides a mix of valid and invalid job IDs, only the names of the valid jobs are shown, and the invalid ones are silently ignored. This could be misleading. For example, if a user enters sky jobs cancel 13 999 and 999 is an invalid ID, the confirmation will only mention job 13. It would be better to display the names for found jobs and the IDs for those not found, so the user gets a complete picture of what they are attempting to cancel.

Suggested change
names = [
f'{r.get("job_name")!r} [{r.get("job_id")}]'
for r in job_records
]
if names:
jobs_str = ', '.join(map(str, names))
else:
jobs_str = ', '.join(map(str, jobs))
job_id_to_name = {r.get('job_id'): r.get('job_name') for r in job_records}
display_parts = []
for job_id in jobs:
job_name = job_id_to_name.get(job_id)
if job_name is not None:
display_parts.append(f'{job_name!r} [{job_id}]')
else:
display_parts.append(str(job_id))
jobs_str = ', '.join(display_parts)

@Michaelvll
Copy link
Collaborator

Thanks for working on this issue @zancheema! Is it possible we update the output to:

Cancelling 13 (name: Train Model o2), 15 (name: Deploy Model o1). Proceed?

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.

[Jobs] Show jobs names in the confirmation message for sky jobs cancel

2 participants