Skip to content

CLI: make sky down/stop/start default to a unique cluster if exists. #2325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

concretevitamin
Copy link
Member

@concretevitamin concretevitamin commented Jul 29, 2023

Partially address #1877.

When I have only 1 cluster in status:

Previously

(py37) ~ » sky down
Usage: sky down [OPTIONS] [CLUSTERS]...
Try 'sky down -h' for help.

Error: `sky down` requires either a cluster name (see `sky status`) or --all.

This PR makes it so that down/stop defaults to it:

(py37) ~ » sky down                                                                                            2 ↵
Terminating 1 cluster: admin. Proceed? [Y/n]: ^CAborted!
(py37) ~ » sky stop                                                                                            1 ↵
Stopping 1 cluster: admin. Proceed? [Y/n]: ^CAborted!

When I have 0 cluster in status: this PR

(py37) ~ » sky down

Cluster(s) not found (tip: see `sky status`).

Same for sky start.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below): above
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh

@concretevitamin concretevitamin changed the title CLI: make sky down/stop default to a unique cluster if exists. CLI: make sky down/stop/start default to a unique cluster if exists. Jul 29, 2023
Copy link
Collaborator

@landscapepainter landscapepainter left a comment

Choose a reason for hiding this comment

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

@concretevitamin Tried this out and all works well! One unexpected behavior was that sky start currently doesn't display any outputs when there is 0 cluster in status while stop/down does. Is this intended?

(base) root@e3f961aef279:~# sky status
Clusters
No existing clusters.

Managed spot jobs
No in progress jobs. (See: sky spot -h)
(base) root@e3f961aef279:~# sky start
(base) root@e3f961aef279:~# sky stop

Cluster(s) not found (tip: see `sky status`).
(base) root@e3f961aef279:~# sky down

Cluster(s) not found (tip: see `sky status`).

When there are >1 clusters, it does behave as expeced:

Clusters
NAME           LAUNCHED    RESOURCES            STATUS  AUTOSTOP  COMMAND                    
sky-0fb2-root  < 1 sec     1x AWS(m6i.2xlarge)  UP      -         sky launch --cloud aws -y  
sky-d04e-root  3 mins ago  1x AWS(m6i.2xlarge)  UP      -         sky start                  

(base) root@e3f961aef279:~# sky stop
Usage: sky stop [OPTIONS] [CLUSTERS]...
Try 'sky stop -h' for help.

Error: `sky stop` requires either a cluster name or glob, or the -a/--all flag.
(base) root@e3f961aef279:~# sky start
Usage: sky start [OPTIONS] [CLUSTERS]...
Try 'sky start -h' for help.

Error: `sky start` requires either a cluster name or glob, or the -a/--all flag.

sky/cli.py Outdated
clusters = all_cluster_names
else:
raise click.UsageError(
'`sky start` requires either a cluster name or glob, '
Copy link
Collaborator

@landscapepainter landscapepainter Jul 30, 2023

Choose a reason for hiding this comment

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

Suggested change
'`sky start` requires either a cluster name or glob, '
'`sky start` requires either a cluster name (see `sky status`) or glob, '

I'm wondering if we should keep the (see 'sky status') to inform (same for sky stop/down)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member Author

@concretevitamin concretevitamin left a comment

Choose a reason for hiding this comment

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

One unexpected behavior was that sky start currently doesn't display any outputs when there is 0 cluster in status while stop/down does. Is this intended?

Great catch, fixed.

sky/cli.py Outdated
clusters = all_cluster_names
else:
raise click.UsageError(
'`sky start` requires either a cluster name or glob, '
Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

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.

2 participants