coiled 1.135.5.dev5__tar.gz → 1.135.5.dev7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/PKG-INFO +2 -2
- coiled-1.135.5.dev7/coiled/cli/_ssh.py +24 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/run.py +3 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/utils.py +63 -37
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/cluster.py +11 -7
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/pyproject.toml +1 -1
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/.gitignore +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/LICENSE +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/README.md +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/__main__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/analytics.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/auth.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/batch.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/capture_environment.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/list.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/logs.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/run.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/status.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/util.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/batch/wait.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/azure_logs.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/better_logs.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/crud.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/get_address.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/list.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/logs.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/metrics.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/ssh.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/cluster/utils.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/config.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/core.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/curl.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/diagnostics.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/env.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/file.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/exit.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/hello_world.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/nyc_parquet.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/pytorch.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/examples/xarray_nwm.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/hello.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/scripts/fill_ipython.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/scripts/nyc_parquet.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/scripts/pytorch.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/scripts/xarray_nwm.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/hello/utils.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/login.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/mpi.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/notebook/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/notebook/notebook.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/package_sync.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/prefect.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/prefect_serve.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/amp.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/aws.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/azure.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/entry.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/gcp.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/prometheus.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/setup/util.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/sync.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cli/utils.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/cluster.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/coiled.yaml +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/compatibility.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/config.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/context.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/core.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/credentials/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/credentials/aws.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/credentials/google.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/errors.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/exceptions.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/extensions/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/extensions/prefect/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/extensions/prefect/runners.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/extensions/prefect/workers.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/filestore.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/function.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/plugins.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/prefect.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/pypi_conda_map.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/scan.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/software.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/software_utils.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/spans.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/spark.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/types.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/cluster_comms.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/core.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/cwi_log_link.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/states.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/widgets/__init__.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/widgets/interface.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/widgets/rich.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/v2/widgets/util.py +0 -0
- {coiled-1.135.5.dev5 → coiled-1.135.5.dev7}/coiled/websockets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: coiled
|
|
3
|
-
Version: 1.135.5.
|
|
3
|
+
Version: 1.135.5.dev7
|
|
4
4
|
Summary: Python client for coiled.io dask clusters
|
|
5
5
|
Project-URL: Homepage, https://coiled.io
|
|
6
6
|
Maintainer-email: Coiled <info@coiled.io>
|
|
@@ -18,7 +18,7 @@ Requires-Dist: fabric>=3.0
|
|
|
18
18
|
Requires-Dist: filelock
|
|
19
19
|
Requires-Dist: gilknocker>=0.4.1
|
|
20
20
|
Requires-Dist: httpx[http2]>=0.15
|
|
21
|
-
Requires-Dist: invoke>=2.
|
|
21
|
+
Requires-Dist: invoke>=2.2.1
|
|
22
22
|
Requires-Dist: ipywidgets
|
|
23
23
|
Requires-Dist: jmespath
|
|
24
24
|
Requires-Dist: jsondiff
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from fabric.runners import Remote
|
|
2
|
+
from invoke.terminals import WINDOWS
|
|
3
|
+
from invoke.util import has_fileno, isatty
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class InteractiveRemote(Remote):
|
|
7
|
+
def read_our_stdin(self, input_):
|
|
8
|
+
try:
|
|
9
|
+
return super().read_our_stdin(input_)
|
|
10
|
+
except SystemError as exc:
|
|
11
|
+
if str(exc) != "buffer overflow" or WINDOWS or not isatty(input_) or not has_fileno(input_):
|
|
12
|
+
raise
|
|
13
|
+
|
|
14
|
+
# Invoke uses a short-sized buffer for FIONREAD, which writes a C int.
|
|
15
|
+
# Python 3.14 rejects that overflow and leaves interactive sessions
|
|
16
|
+
# without stdin. Retry with the correct size until Invoke fixes it:
|
|
17
|
+
# https://github.com/pyinvoke/invoke/pull/1077
|
|
18
|
+
import fcntl
|
|
19
|
+
import struct
|
|
20
|
+
import termios
|
|
21
|
+
|
|
22
|
+
available = fcntl.ioctl(input_, termios.FIONREAD, struct.pack("i", 0))
|
|
23
|
+
data = input_.read(struct.unpack("i", available)[0])
|
|
24
|
+
return self.decode(data) if isinstance(data, bytes) else data
|
|
@@ -34,6 +34,7 @@ from coiled.v2.core import Cloud
|
|
|
34
34
|
from coiled.v2.widgets.rich import LightRichClusterWidget
|
|
35
35
|
|
|
36
36
|
from ..filestore import FilestoreManager
|
|
37
|
+
from ._ssh import InteractiveRemote
|
|
37
38
|
from .sync import SYNC_TARGET, start_sync, stop_sync
|
|
38
39
|
from .utils import CONTEXT_SETTINGS
|
|
39
40
|
|
|
@@ -184,6 +185,8 @@ def run_via_ssh(
|
|
|
184
185
|
console = console or Console()
|
|
185
186
|
|
|
186
187
|
connection = get_ssh_connection(cloud, cluster.cluster_id)
|
|
188
|
+
if interactive:
|
|
189
|
+
connection.config.runners.remote = InteractiveRemote
|
|
187
190
|
results = None
|
|
188
191
|
|
|
189
192
|
original_command = coiled.utils.join_command_parts(command)
|
|
@@ -29,7 +29,7 @@ from math import ceil
|
|
|
29
29
|
from pathlib import Path
|
|
30
30
|
from tempfile import TemporaryDirectory as TemporaryDirectoryBase
|
|
31
31
|
from tempfile import mkdtemp
|
|
32
|
-
from typing import Callable, Dict, Iterable, List, NoReturn, Optional, Set, Tuple, Union
|
|
32
|
+
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, NoReturn, Optional, Set, Tuple, Union
|
|
33
33
|
from urllib.parse import unquote, urlencode, urlparse
|
|
34
34
|
from zipfile import PyZipFile
|
|
35
35
|
|
|
@@ -76,6 +76,9 @@ from coiled.types import AWSOptions, AzureOptions, FirewallOptions, GCPOptions
|
|
|
76
76
|
from .compatibility import COILED_VERSION
|
|
77
77
|
from .errors import ServerError
|
|
78
78
|
|
|
79
|
+
if TYPE_CHECKING:
|
|
80
|
+
from .core import CloudSyncAsync
|
|
81
|
+
|
|
79
82
|
logger = logging.getLogger(__name__)
|
|
80
83
|
|
|
81
84
|
COILED_DIR = str(Path(__file__).parent)
|
|
@@ -1170,7 +1173,8 @@ def parse_requested_memory(
|
|
|
1170
1173
|
return parsed_memory
|
|
1171
1174
|
|
|
1172
1175
|
|
|
1173
|
-
def _get_preferred_instance_types_from_cpu_memory(
|
|
1176
|
+
async def _get_preferred_instance_types_from_cpu_memory(
|
|
1177
|
+
cloud: CloudSyncAsync,
|
|
1174
1178
|
include_unbalanced: bool,
|
|
1175
1179
|
cpu: Union[int, List[int]] | None,
|
|
1176
1180
|
memory: Union[int, str, float, List[int], List[str], List[float]] | None,
|
|
@@ -1180,9 +1184,6 @@ def _get_preferred_instance_types_from_cpu_memory(
|
|
|
1180
1184
|
recommended: bool,
|
|
1181
1185
|
no_family_filter: bool,
|
|
1182
1186
|
) -> List[Tuple[str, VmType]]:
|
|
1183
|
-
# Circular imports
|
|
1184
|
-
from .core import list_instance_types
|
|
1185
|
-
|
|
1186
1187
|
if backend == "gcp":
|
|
1187
1188
|
family_prefix = "t2a" if arch == "arm64" else ("n1" if gpus else "e2")
|
|
1188
1189
|
|
|
@@ -1197,8 +1198,8 @@ def _get_preferred_instance_types_from_cpu_memory(
|
|
|
1197
1198
|
|
|
1198
1199
|
instances = [
|
|
1199
1200
|
(instance_name, instance_specs)
|
|
1200
|
-
for instance_name, instance_specs in
|
|
1201
|
-
cores=cpu, memory=memory, backend=backend, arch=arch
|
|
1201
|
+
for instance_name, instance_specs in (
|
|
1202
|
+
await cloud._list_instance_types(cores=cpu, memory=memory, backend=backend, arch=arch)
|
|
1202
1203
|
).items()
|
|
1203
1204
|
if instance_name.startswith(instance_family) or no_family_filter
|
|
1204
1205
|
]
|
|
@@ -1213,8 +1214,8 @@ def _get_preferred_instance_types_from_cpu_memory(
|
|
|
1213
1214
|
|
|
1214
1215
|
instances = [
|
|
1215
1216
|
(instance_name, instance_specs)
|
|
1216
|
-
for instance_name, instance_specs in
|
|
1217
|
-
cores=cpu, memory=memory, backend=backend, arch=arch
|
|
1217
|
+
for instance_name, instance_specs in (
|
|
1218
|
+
await cloud._list_instance_types(cores=cpu, memory=memory, backend=backend, arch=arch)
|
|
1218
1219
|
).items()
|
|
1219
1220
|
if instance_name.startswith(instance_family) or no_family_filter
|
|
1220
1221
|
]
|
|
@@ -1229,8 +1230,8 @@ def _get_preferred_instance_types_from_cpu_memory(
|
|
|
1229
1230
|
|
|
1230
1231
|
instances = [
|
|
1231
1232
|
(instance_name, instance_specs)
|
|
1232
|
-
for instance_name, instance_specs in
|
|
1233
|
-
cores=cpu, memory=memory, backend=backend, arch=arch
|
|
1233
|
+
for instance_name, instance_specs in (
|
|
1234
|
+
await cloud._list_instance_types(cores=cpu, memory=memory, backend=backend, arch=arch)
|
|
1234
1235
|
).items()
|
|
1235
1236
|
if re.match(aws_family_filter, instance_name) or no_family_filter
|
|
1236
1237
|
]
|
|
@@ -1240,8 +1241,8 @@ def _get_preferred_instance_types_from_cpu_memory(
|
|
|
1240
1241
|
return instances
|
|
1241
1242
|
|
|
1242
1243
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1244
|
+
async def _get_instance_type_from_cpu_memory(
|
|
1245
|
+
cloud: CloudSyncAsync,
|
|
1245
1246
|
cpu: Union[str, int, List[int]] | None = None,
|
|
1246
1247
|
memory: Union[int, str, float, List[int], List[str], List[float]] | None = None,
|
|
1247
1248
|
gpus: int | None = None,
|
|
@@ -1249,26 +1250,6 @@ def get_instance_type_from_cpu_memory(
|
|
|
1249
1250
|
arch: Literal["x86_64", "arm64"] = "x86_64",
|
|
1250
1251
|
recommended: bool = False,
|
|
1251
1252
|
) -> List[str]:
|
|
1252
|
-
"""Get instances by cpu/memory combination.
|
|
1253
|
-
|
|
1254
|
-
We are using the `list_instance_types` method to get the
|
|
1255
|
-
instances that match the cpu/memory specification. If no
|
|
1256
|
-
instance can be found we will raise an exception
|
|
1257
|
-
informing the user about this.
|
|
1258
|
-
|
|
1259
|
-
Arguments:
|
|
1260
|
-
cpu: Filter by number of vCPUs. Examples: ``8``, ``[2, 8]`` (for range), or ``"*"`` (match any number,
|
|
1261
|
-
used if you want to include unbalanced options while specifying memory).
|
|
1262
|
-
memory: Filter by memory. Examples: ``8192`` (megabytes), ``"8 GiB"``, ``["2 GiB", "8 GiB"]`` (for range), or
|
|
1263
|
-
``"*"`` (match any amount, used if you want to include unbalanced options while specifying vCPU count).
|
|
1264
|
-
gpus: Filter by number of GPUs.
|
|
1265
|
-
backend: Cloud provider.
|
|
1266
|
-
arch: CPU architecture.
|
|
1267
|
-
recommended: Filter out instances that are not recommended (such as t3 family).
|
|
1268
|
-
"""
|
|
1269
|
-
# Circular imports
|
|
1270
|
-
from .core import list_instance_types
|
|
1271
|
-
|
|
1272
1253
|
include_unbalanced = bool(cpu and memory)
|
|
1273
1254
|
|
|
1274
1255
|
cpu = None if cpu == "*" else cpu
|
|
@@ -1284,7 +1265,8 @@ def get_instance_type_from_cpu_memory(
|
|
|
1284
1265
|
if isinstance(cpu, str):
|
|
1285
1266
|
cpu = int(cpu)
|
|
1286
1267
|
|
|
1287
|
-
instances = _get_preferred_instance_types_from_cpu_memory(
|
|
1268
|
+
instances = await _get_preferred_instance_types_from_cpu_memory(
|
|
1269
|
+
cloud=cloud,
|
|
1288
1270
|
include_unbalanced=include_unbalanced,
|
|
1289
1271
|
cpu=cpu,
|
|
1290
1272
|
memory=memory,
|
|
@@ -1300,7 +1282,8 @@ def get_instance_type_from_cpu_memory(
|
|
|
1300
1282
|
# We'll see if there are unbalanced types that match what the user specified, and if so,
|
|
1301
1283
|
# let the user know what these are and how to get them.
|
|
1302
1284
|
if not include_unbalanced:
|
|
1303
|
-
unbalanced_instances = _get_preferred_instance_types_from_cpu_memory(
|
|
1285
|
+
unbalanced_instances = await _get_preferred_instance_types_from_cpu_memory(
|
|
1286
|
+
cloud=cloud,
|
|
1304
1287
|
include_unbalanced=True,
|
|
1305
1288
|
cpu=cpu,
|
|
1306
1289
|
memory=memory,
|
|
@@ -1338,7 +1321,8 @@ def get_instance_type_from_cpu_memory(
|
|
|
1338
1321
|
)
|
|
1339
1322
|
raise InstanceTypeError(error_message)
|
|
1340
1323
|
|
|
1341
|
-
any_instances = _get_preferred_instance_types_from_cpu_memory(
|
|
1324
|
+
any_instances = await _get_preferred_instance_types_from_cpu_memory(
|
|
1325
|
+
cloud=cloud,
|
|
1342
1326
|
include_unbalanced=True,
|
|
1343
1327
|
cpu=cpu,
|
|
1344
1328
|
memory=memory,
|
|
@@ -1388,7 +1372,7 @@ We recommend strings like "32 GiB", or numbers like 32e9.
|
|
|
1388
1372
|
|
|
1389
1373
|
if cpu and memory:
|
|
1390
1374
|
memory_matching_instances = [
|
|
1391
|
-
instance_name for instance_name in
|
|
1375
|
+
instance_name for instance_name in await cloud._list_instance_types(memory=memory, backend=backend)
|
|
1392
1376
|
]
|
|
1393
1377
|
|
|
1394
1378
|
if memory_matching_instances:
|
|
@@ -1410,6 +1394,48 @@ We recommend strings like "32 GiB", or numbers like 32e9.
|
|
|
1410
1394
|
return instance_names
|
|
1411
1395
|
|
|
1412
1396
|
|
|
1397
|
+
@track_context
|
|
1398
|
+
def get_instance_type_from_cpu_memory(
|
|
1399
|
+
cpu: Union[str, int, List[int]] | None = None,
|
|
1400
|
+
memory: Union[int, str, float, List[int], List[str], List[float]] | None = None,
|
|
1401
|
+
gpus: int | None = None,
|
|
1402
|
+
backend: str = "aws",
|
|
1403
|
+
arch: Literal["x86_64", "arm64"] = "x86_64",
|
|
1404
|
+
recommended: bool = False,
|
|
1405
|
+
) -> List[str]:
|
|
1406
|
+
"""Get instances by cpu/memory combination.
|
|
1407
|
+
|
|
1408
|
+
We are using the `list_instance_types` method to get the
|
|
1409
|
+
instances that match the cpu/memory specification. If no
|
|
1410
|
+
instance can be found we will raise an exception
|
|
1411
|
+
informing the user about this.
|
|
1412
|
+
|
|
1413
|
+
Arguments:
|
|
1414
|
+
cpu: Filter by number of vCPUs. Examples: ``8``, ``[2, 8]`` (for range), or ``"*"`` (match any number,
|
|
1415
|
+
used if you want to include unbalanced options while specifying memory).
|
|
1416
|
+
memory: Filter by memory. Examples: ``8192`` (megabytes), ``"8 GiB"``, ``["2 GiB", "8 GiB"]`` (for range), or
|
|
1417
|
+
``"*"`` (match any amount, used if you want to include unbalanced options while specifying vCPU count).
|
|
1418
|
+
gpus: Filter by number of GPUs.
|
|
1419
|
+
backend: Cloud provider.
|
|
1420
|
+
arch: CPU architecture.
|
|
1421
|
+
recommended: Filter out instances that are not recommended (such as t3 family).
|
|
1422
|
+
"""
|
|
1423
|
+
# Circular import
|
|
1424
|
+
from .core import Cloud
|
|
1425
|
+
|
|
1426
|
+
with Cloud() as cloud:
|
|
1427
|
+
return cloud._sync(
|
|
1428
|
+
_get_instance_type_from_cpu_memory,
|
|
1429
|
+
cloud=cloud,
|
|
1430
|
+
cpu=cpu,
|
|
1431
|
+
memory=memory,
|
|
1432
|
+
gpus=gpus,
|
|
1433
|
+
backend=backend,
|
|
1434
|
+
arch=arch,
|
|
1435
|
+
recommended=recommended,
|
|
1436
|
+
)
|
|
1437
|
+
|
|
1438
|
+
|
|
1413
1439
|
def any_gpu_instance_type(type_list: Union[str, List[str]] | None) -> bool:
|
|
1414
1440
|
# TODO (future PR) ideally we'd get this from database via endpoint as part of preflight check
|
|
1415
1441
|
# but for now we'll just use regex to match instance types with bundled GPU
|
|
@@ -68,12 +68,12 @@ from coiled.utils import (
|
|
|
68
68
|
COILED_LOGGER_NAME,
|
|
69
69
|
DASK_PRESPAWN_THREAD_VARS_UNSET,
|
|
70
70
|
GCP_SCHEDULER_GPU,
|
|
71
|
+
_get_instance_type_from_cpu_memory,
|
|
71
72
|
any_gpu_instance_type,
|
|
72
73
|
cluster_firewall,
|
|
73
74
|
error_info_for_tracking,
|
|
74
75
|
get_details_url,
|
|
75
76
|
get_grafana_url,
|
|
76
|
-
get_instance_type_from_cpu_memory,
|
|
77
77
|
is_arm_only_image,
|
|
78
78
|
normalize_environ,
|
|
79
79
|
parse_bytes_as_gib,
|
|
@@ -1149,7 +1149,8 @@ class Cluster(DistributedCluster, Generic[IsAsynchronous]):
|
|
|
1149
1149
|
cloud = self.cloud
|
|
1150
1150
|
if (self.worker_cpu or self.worker_memory) and not self.worker_vm_types:
|
|
1151
1151
|
# match worker types by cpu and/or memory
|
|
1152
|
-
worker_vm_types_to_use =
|
|
1152
|
+
worker_vm_types_to_use = await _get_instance_type_from_cpu_memory(
|
|
1153
|
+
cloud,
|
|
1153
1154
|
self.worker_cpu,
|
|
1154
1155
|
self.worker_memory,
|
|
1155
1156
|
gpus=self.worker_gpu_count,
|
|
@@ -1171,7 +1172,8 @@ class Cluster(DistributedCluster, Generic[IsAsynchronous]):
|
|
|
1171
1172
|
|
|
1172
1173
|
if (self.scheduler_cpu or self.scheduler_memory) and not self.scheduler_vm_types:
|
|
1173
1174
|
# match scheduler types by cpu and/or memory
|
|
1174
|
-
scheduler_vm_types_to_use =
|
|
1175
|
+
scheduler_vm_types_to_use = await _get_instance_type_from_cpu_memory(
|
|
1176
|
+
cloud,
|
|
1175
1177
|
self.scheduler_cpu,
|
|
1176
1178
|
self.scheduler_memory,
|
|
1177
1179
|
gpus=1 if self.scheduler_gpu else 0,
|
|
@@ -1194,7 +1196,6 @@ class Cluster(DistributedCluster, Generic[IsAsynchronous]):
|
|
|
1194
1196
|
# If we still don't have instance types, use the defaults
|
|
1195
1197
|
if not scheduler_vm_types_to_use or not worker_vm_types_to_use:
|
|
1196
1198
|
provider = await self._get_account_cloud_provider_name()
|
|
1197
|
-
|
|
1198
1199
|
if not self.scheduler_gpu and not self.worker_gpu_count:
|
|
1199
1200
|
# When no GPUs, use same default for scheduler and workers
|
|
1200
1201
|
default_vm_types = await cloud._get_default_instance_types(
|
|
@@ -1207,15 +1208,18 @@ class Cluster(DistributedCluster, Generic[IsAsynchronous]):
|
|
|
1207
1208
|
else:
|
|
1208
1209
|
# GPUs so there might be different defaults for scheduler/workers
|
|
1209
1210
|
if not scheduler_vm_types_to_use:
|
|
1210
|
-
scheduler_vm_types_to_use =
|
|
1211
|
+
scheduler_vm_types_to_use = await _get_instance_type_from_cpu_memory(
|
|
1212
|
+
cloud=cloud,
|
|
1211
1213
|
gpus=1 if self.scheduler_gpu else 0,
|
|
1212
|
-
backend=
|
|
1214
|
+
backend=provider,
|
|
1213
1215
|
arch=self.arch.vm_arch,
|
|
1214
1216
|
recommended=True,
|
|
1215
1217
|
)
|
|
1216
1218
|
if not worker_vm_types_to_use:
|
|
1217
|
-
worker_vm_types_to_use =
|
|
1219
|
+
worker_vm_types_to_use = await _get_instance_type_from_cpu_memory(
|
|
1220
|
+
cloud=cloud,
|
|
1218
1221
|
gpus=self.worker_gpu_count,
|
|
1222
|
+
backend=provider,
|
|
1219
1223
|
arch=self.arch.vm_arch,
|
|
1220
1224
|
recommended=True,
|
|
1221
1225
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|