Skip to content
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

Changed dstack pool remove to rm [Issue #1256] #1258

Merged
merged 3 commits into from
May 21, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions src/dstack/_internal/cli/commands/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
from rich.table import Table

from dstack._internal.cli.commands import APIBaseCommand
from dstack._internal.cli.services.args import cpu_spec, disk_spec, gpu_spec, memory_spec
from dstack._internal.cli.services.args import (
cpu_spec,
disk_spec,
gpu_spec,
memory_spec,
)
from dstack._internal.cli.services.profile import (
apply_profile_args,
register_profile_args,
Expand All @@ -25,11 +30,22 @@
)
from dstack._internal.core.models.pools import Instance, Pool
from dstack._internal.core.models.profiles import Profile, SpotPolicy, parse_duration
from dstack._internal.core.models.resources import DEFAULT_CPU_COUNT, DEFAULT_MEMORY_SIZE
from dstack._internal.core.models.runs import InstanceStatus, Requirements, get_policy_map
from dstack._internal.core.models.resources import (
DEFAULT_CPU_COUNT,
DEFAULT_MEMORY_SIZE,
)
from dstack._internal.core.models.runs import (
InstanceStatus,
Requirements,
get_policy_map,
)
from dstack._internal.utils.common import pretty_date
from dstack._internal.utils.logging import get_logger
from dstack._internal.utils.ssh import convert_pkcs8_to_pem, generate_public_key, rsa_pkey_from_str
from dstack._internal.utils.ssh import (
convert_pkcs8_to_pem,
generate_public_key,
rsa_pkey_from_str,
)
from dstack.api._public.resources import Resources
from dstack.api.utils import load_profile

Expand Down Expand Up @@ -100,7 +116,9 @@ def _register(self) -> None:

# add instance
add_parser = subparsers.add_parser(
"add", help="Add instance to pool", formatter_class=self._parser.formatter_class
"add",
help="Add instance to pool",
formatter_class=self._parser.formatter_class,
)
self._parser.add_argument(
"--max-offers",
Expand All @@ -117,9 +135,10 @@ def _register(self) -> None:

# remove instance
remove_parser = subparsers.add_parser(
"remove",
"rm",
help="Remove instance from the pool",
formatter_class=self._parser.formatter_class,
aliases=["remove"],
)
remove_parser.add_argument(
"instance_name",
Expand Down Expand Up @@ -231,7 +250,8 @@ def _ps(self, args: argparse.Namespace) -> None:
while True:
resp = self.api.client.pool.show(self.api.project, args.pool_name)
group = Group(
pool_name_template.format(resp.name), get_instance_table(resp.instances)
pool_name_template.format(resp.name),
get_instance_table(resp.instances),
)
live.update(group)
time.sleep(LIVE_PROVISION_INTERVAL_SECS)
Expand Down
Loading