dstack 0.19.11rc1__py3-none-any.whl → 0.19.12__py3-none-any.whl
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.
Potentially problematic release.
This version of dstack might be problematic. Click here for more details.
- dstack/_internal/cli/commands/offer.py +2 -0
- dstack/_internal/cli/services/configurators/run.py +43 -42
- dstack/_internal/cli/utils/run.py +10 -26
- dstack/_internal/cli/utils/updates.py +13 -1
- dstack/_internal/core/backends/aws/compute.py +21 -9
- dstack/_internal/core/backends/base/compute.py +7 -3
- dstack/_internal/core/backends/gcp/compute.py +43 -20
- dstack/_internal/core/backends/gcp/resources.py +18 -2
- dstack/_internal/core/backends/local/compute.py +4 -2
- dstack/_internal/core/backends/template/configurator.py.jinja +1 -6
- dstack/_internal/core/backends/template/models.py.jinja +4 -0
- dstack/_internal/core/models/configurations.py +1 -1
- dstack/_internal/core/models/fleets.py +6 -1
- dstack/_internal/core/models/profiles.py +43 -3
- dstack/_internal/core/models/repos/local.py +19 -13
- dstack/_internal/core/models/runs.py +78 -45
- dstack/_internal/server/background/tasks/process_running_jobs.py +47 -12
- dstack/_internal/server/background/tasks/process_runs.py +14 -1
- dstack/_internal/server/background/tasks/process_submitted_jobs.py +3 -3
- dstack/_internal/server/routers/repos.py +9 -4
- dstack/_internal/server/services/fleets.py +2 -2
- dstack/_internal/server/services/gateways/__init__.py +1 -1
- dstack/_internal/server/services/jobs/__init__.py +4 -4
- dstack/_internal/server/services/plugins.py +64 -32
- dstack/_internal/server/services/runner/client.py +4 -1
- dstack/_internal/server/services/runs.py +2 -2
- dstack/_internal/server/services/volumes.py +1 -1
- dstack/_internal/server/statics/index.html +1 -1
- dstack/_internal/server/statics/{main-b4803049eac16aea9a49.js → main-b0e80f8e26a168c129e9.js} +72 -25
- dstack/_internal/server/statics/{main-b4803049eac16aea9a49.js.map → main-b0e80f8e26a168c129e9.js.map} +1 -1
- dstack/_internal/server/testing/common.py +2 -1
- dstack/_internal/utils/common.py +4 -0
- dstack/api/server/_fleets.py +5 -1
- dstack/api/server/_runs.py +8 -0
- dstack/plugins/builtin/__init__.py +0 -0
- dstack/plugins/builtin/rest_plugin/__init__.py +18 -0
- dstack/plugins/builtin/rest_plugin/_models.py +48 -0
- dstack/plugins/builtin/rest_plugin/_plugin.py +127 -0
- dstack/version.py +1 -1
- {dstack-0.19.11rc1.dist-info → dstack-0.19.12.dist-info}/METADATA +2 -2
- {dstack-0.19.11rc1.dist-info → dstack-0.19.12.dist-info}/RECORD +44 -41
- dstack/_internal/utils/ignore.py +0 -92
- {dstack-0.19.11rc1.dist-info → dstack-0.19.12.dist-info}/WHEEL +0 -0
- {dstack-0.19.11rc1.dist-info → dstack-0.19.12.dist-info}/entry_points.txt +0 -0
- {dstack-0.19.11rc1.dist-info → dstack-0.19.12.dist-info}/licenses/LICENSE.md +0 -0
dstack/_internal/utils/ignore.py
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import fnmatch
|
|
2
|
-
from itertools import zip_longest
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Dict, List, Optional
|
|
5
|
-
|
|
6
|
-
from dstack._internal.utils.path import PathLike
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class GitIgnore:
|
|
10
|
-
def __init__(
|
|
11
|
-
self, root_dir: PathLike, ignore_files: List[str] = None, globs: List[str] = None
|
|
12
|
-
):
|
|
13
|
-
self.root_dir = Path(root_dir)
|
|
14
|
-
self.ignore_files = (
|
|
15
|
-
ignore_files
|
|
16
|
-
if ignore_files is not None
|
|
17
|
-
else [".gitignore", ".git/info/exclude", ".dstackignore"]
|
|
18
|
-
)
|
|
19
|
-
self.ignore_globs: Dict[str, List[str]] = {".": globs or []}
|
|
20
|
-
self.load_recursive()
|
|
21
|
-
|
|
22
|
-
def load_ignore_file(self, path: str, ignore_file: Path):
|
|
23
|
-
if path != "." and not path.startswith("./"):
|
|
24
|
-
path = "./" + path
|
|
25
|
-
if path not in self.ignore_globs:
|
|
26
|
-
self.ignore_globs[path] = []
|
|
27
|
-
with ignore_file.open("r") as f:
|
|
28
|
-
for line in f:
|
|
29
|
-
line = self.rstrip(line.rstrip("\n")).rstrip("/")
|
|
30
|
-
line = line.replace("\\ ", " ")
|
|
31
|
-
if line.startswith("#") or not line:
|
|
32
|
-
continue
|
|
33
|
-
self.ignore_globs[path].append(line)
|
|
34
|
-
|
|
35
|
-
def load_recursive(self, path: Optional[Path] = None):
|
|
36
|
-
path = path or self.root_dir
|
|
37
|
-
for ignore_file in self.ignore_files:
|
|
38
|
-
ignore_file = path / ignore_file
|
|
39
|
-
if ignore_file.exists():
|
|
40
|
-
self.load_ignore_file(str(path.relative_to(self.root_dir)), ignore_file)
|
|
41
|
-
|
|
42
|
-
for subdir in path.iterdir():
|
|
43
|
-
if not subdir.is_dir() or self.ignore(subdir.relative_to(self.root_dir)):
|
|
44
|
-
continue
|
|
45
|
-
self.load_recursive(subdir)
|
|
46
|
-
|
|
47
|
-
@staticmethod
|
|
48
|
-
def rstrip(value: str) -> str:
|
|
49
|
-
end = len(value) - 1
|
|
50
|
-
while end >= 0:
|
|
51
|
-
if not value[end].isspace():
|
|
52
|
-
break
|
|
53
|
-
if end > 0 and value[end - 1] == "\\":
|
|
54
|
-
break # escaped space
|
|
55
|
-
end -= 1
|
|
56
|
-
else:
|
|
57
|
-
return ""
|
|
58
|
-
return value[: end + 1]
|
|
59
|
-
|
|
60
|
-
@staticmethod
|
|
61
|
-
def fnmatch(name: str, pattern: str, sep="/") -> bool:
|
|
62
|
-
if pattern.startswith(sep):
|
|
63
|
-
name = sep + name
|
|
64
|
-
for n, p in zip_longest(
|
|
65
|
-
reversed(name.split(sep)), reversed(pattern.split(sep)), fillvalue=None
|
|
66
|
-
):
|
|
67
|
-
if p == "**":
|
|
68
|
-
raise NotImplementedError()
|
|
69
|
-
if p is None:
|
|
70
|
-
return True
|
|
71
|
-
if n is None or not fnmatch.fnmatch(n, p):
|
|
72
|
-
return False
|
|
73
|
-
return True
|
|
74
|
-
|
|
75
|
-
def ignore(self, path: PathLike, sep="/") -> bool:
|
|
76
|
-
if not path:
|
|
77
|
-
return False
|
|
78
|
-
path = Path(path)
|
|
79
|
-
if path.is_absolute():
|
|
80
|
-
path = path.relative_to(self.root_dir)
|
|
81
|
-
|
|
82
|
-
tokens = ("." + sep + str(path)).split(sep)
|
|
83
|
-
for i in range(1, len(tokens)):
|
|
84
|
-
parent = sep.join(tokens[:-i])
|
|
85
|
-
globs = self.ignore_globs.get(parent)
|
|
86
|
-
if not globs:
|
|
87
|
-
continue
|
|
88
|
-
name = sep.join(tokens[-i:])
|
|
89
|
-
for glob in globs:
|
|
90
|
-
if self.fnmatch(name, glob, sep=sep):
|
|
91
|
-
return True
|
|
92
|
-
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|