coiled 1.125.0__py3-none-any.whl → 1.125.1.dev2__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 coiled might be problematic. Click here for more details.
- coiled/cli/file.py +88 -13
- coiled/cli/hello/hello.py +5 -4
- coiled/filestore.py +20 -1
- {coiled-1.125.0.dist-info → coiled-1.125.1.dev2.dist-info}/METADATA +1 -1
- {coiled-1.125.0.dist-info → coiled-1.125.1.dev2.dist-info}/RECORD +8 -8
- {coiled-1.125.0.dist-info → coiled-1.125.1.dev2.dist-info}/WHEEL +0 -0
- {coiled-1.125.0.dist-info → coiled-1.125.1.dev2.dist-info}/entry_points.txt +0 -0
- {coiled-1.125.0.dist-info → coiled-1.125.1.dev2.dist-info}/licenses/LICENSE +0 -0
coiled/cli/file.py
CHANGED
|
@@ -16,26 +16,101 @@ from .utils import CONTEXT_SETTINGS
|
|
|
16
16
|
default=None,
|
|
17
17
|
help="Coiled workspace (uses default workspace if not specified).",
|
|
18
18
|
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--filestore",
|
|
21
|
+
default=None,
|
|
22
|
+
help="Name of filestore (optional).",
|
|
23
|
+
)
|
|
24
|
+
@click.option(
|
|
25
|
+
"--filter",
|
|
26
|
+
"name_includes",
|
|
27
|
+
default=None,
|
|
28
|
+
help="Filter on file paths and/or names to download (optional).",
|
|
29
|
+
)
|
|
19
30
|
@click.option("--into", default=".")
|
|
20
|
-
def download(cluster, workspace, into):
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# TODO (possible enhancement) if there are multiple output filestores, let user pick which to download
|
|
29
|
-
for attachment in attachments:
|
|
30
|
-
if attachment["output"]:
|
|
31
|
+
def download(cluster, workspace, filestore, name_includes, into):
|
|
32
|
+
if filestore:
|
|
33
|
+
filestores = FilestoreManager.get_filestore(name=filestore) or []
|
|
34
|
+
if not filestores:
|
|
35
|
+
print(f"{filestore} filestore not found")
|
|
36
|
+
|
|
37
|
+
for fs in filestores:
|
|
31
38
|
coiled.filestore.download_from_filestore_with_ui(
|
|
32
|
-
fs=
|
|
33
|
-
into=
|
|
39
|
+
fs=fs,
|
|
40
|
+
into=into,
|
|
41
|
+
name_includes=name_includes,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
else:
|
|
45
|
+
with coiled.Cloud(workspace=workspace) as cloud:
|
|
46
|
+
cluster_info = find_cluster(cloud, cluster)
|
|
47
|
+
cluster_id = cluster_info["id"]
|
|
48
|
+
attachments = FilestoreManager.get_cluster_attachments(cluster_id)
|
|
49
|
+
if not attachments:
|
|
50
|
+
print(f"No filestore found for {cluster_info['name']} ({cluster_info['id']})")
|
|
51
|
+
|
|
52
|
+
# TODO (possible enhancement) if there are multiple output filestores, let user pick which to download
|
|
53
|
+
for attachment in attachments:
|
|
54
|
+
if attachment["output"]:
|
|
55
|
+
coiled.filestore.download_from_filestore_with_ui(
|
|
56
|
+
fs=attachment["filestore"],
|
|
57
|
+
into=into,
|
|
58
|
+
name_includes=name_includes,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@click.command(
|
|
63
|
+
context_settings=CONTEXT_SETTINGS,
|
|
64
|
+
)
|
|
65
|
+
@click.argument("cluster", default="", required=False)
|
|
66
|
+
@click.option(
|
|
67
|
+
"--workspace",
|
|
68
|
+
default=None,
|
|
69
|
+
help="Coiled workspace (uses default workspace if not specified).",
|
|
70
|
+
)
|
|
71
|
+
@click.option(
|
|
72
|
+
"--filestore",
|
|
73
|
+
default=None,
|
|
74
|
+
help="Name of filestore (optional).",
|
|
75
|
+
)
|
|
76
|
+
@click.option(
|
|
77
|
+
"--filter",
|
|
78
|
+
"name_includes",
|
|
79
|
+
default=None,
|
|
80
|
+
help="Filter on file paths and/or names to download (optional).",
|
|
81
|
+
)
|
|
82
|
+
def list_files(cluster, workspace, filestore, name_includes):
|
|
83
|
+
if filestore:
|
|
84
|
+
filestores = FilestoreManager.get_filestore(name=filestore) or []
|
|
85
|
+
if not filestores:
|
|
86
|
+
print(f"{filestore} filestore not found")
|
|
87
|
+
|
|
88
|
+
for fs in filestores:
|
|
89
|
+
coiled.filestore.list_files_ui(
|
|
90
|
+
fs=fs,
|
|
91
|
+
name_includes=name_includes,
|
|
34
92
|
)
|
|
35
93
|
|
|
94
|
+
else:
|
|
95
|
+
with coiled.Cloud(workspace=workspace) as cloud:
|
|
96
|
+
cluster_info = find_cluster(cloud, cluster)
|
|
97
|
+
cluster_id = cluster_info["id"]
|
|
98
|
+
attachments = FilestoreManager.get_cluster_attachments(cluster_id)
|
|
99
|
+
if not attachments:
|
|
100
|
+
print(f"No filestore found for {cluster_info['name']} ({cluster_info['id']})")
|
|
101
|
+
|
|
102
|
+
# TODO (possible enhancement) if there are multiple output filestores, let user pick which to download
|
|
103
|
+
for attachment in attachments:
|
|
104
|
+
if attachment["output"]:
|
|
105
|
+
coiled.filestore.list_files_ui(
|
|
106
|
+
fs=attachment["filestore"],
|
|
107
|
+
name_includes=name_includes,
|
|
108
|
+
)
|
|
109
|
+
|
|
36
110
|
|
|
37
111
|
@click.group(name="file", context_settings=CONTEXT_SETTINGS)
|
|
38
112
|
def file_group(): ...
|
|
39
113
|
|
|
40
114
|
|
|
41
115
|
file_group.add_command(download)
|
|
116
|
+
file_group.add_command(list_files, "list")
|
coiled/cli/hello/hello.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
|
-
import json
|
|
5
|
-
import subprocess
|
|
6
4
|
import sys
|
|
7
5
|
import time
|
|
8
6
|
|
|
@@ -18,6 +16,7 @@ import coiled
|
|
|
18
16
|
from coiled.scan import scan_prefix
|
|
19
17
|
from coiled.utils import login_if_required
|
|
20
18
|
|
|
19
|
+
from ..curl import sync_request
|
|
21
20
|
from .examples import examples
|
|
22
21
|
from .utils import PRIMARY_COLOR, Panel, console, has_macos_system_python, log_interactions
|
|
23
22
|
|
|
@@ -41,8 +40,10 @@ def needs_login():
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
def get_interactions():
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
with coiled.Cloud() as cloud:
|
|
44
|
+
return sync_request(
|
|
45
|
+
cloud, url=f"{cloud.server}/api/v2/interactions/user-interactions/hello", method="get", json_output=True
|
|
46
|
+
)
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
def get_already_run_examples():
|
coiled/filestore.py
CHANGED
|
@@ -33,10 +33,24 @@ def wait_until_complete(cluster_id, wait_for_output=True, wait_for_input=False):
|
|
|
33
33
|
return attachments
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def
|
|
36
|
+
def list_files_ui(fs, name_includes=None):
|
|
37
|
+
blobs = FilestoreManager.get_download_list_with_urls(fs["id"])
|
|
38
|
+
|
|
39
|
+
if name_includes:
|
|
40
|
+
blobs = [blob for blob in blobs if name_includes in blob["relative_path"]]
|
|
41
|
+
|
|
42
|
+
for blob in blobs:
|
|
43
|
+
print(blob["relative_path"])
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def download_from_filestore_with_ui(fs, into=".", name_includes=None):
|
|
37
47
|
if fs:
|
|
38
48
|
# TODO (possible enhancement) if "has files" flag is set then make sure we do see files to download?
|
|
39
49
|
blobs = FilestoreManager.get_download_list_with_urls(fs["id"])
|
|
50
|
+
|
|
51
|
+
if name_includes:
|
|
52
|
+
blobs = [blob for blob in blobs if name_includes in blob["relative_path"]]
|
|
53
|
+
|
|
40
54
|
total_bytes = sum(blob["size"] for blob in blobs)
|
|
41
55
|
|
|
42
56
|
size_label = "Bytes"
|
|
@@ -195,6 +209,11 @@ class FilestoreManagerWithoutHttp:
|
|
|
195
209
|
def make_req(api_path, post=False, data=None):
|
|
196
210
|
raise NotImplementedError()
|
|
197
211
|
|
|
212
|
+
@classmethod
|
|
213
|
+
def get_filestore(cls, name=None):
|
|
214
|
+
if name:
|
|
215
|
+
return cls.make_req(f"/api/v2/filestore/name/{name}").get("filestores")
|
|
216
|
+
|
|
198
217
|
@classmethod
|
|
199
218
|
def get_or_create_filestores(cls, names, workspace, region):
|
|
200
219
|
return cls.make_req(
|
|
@@ -12,7 +12,7 @@ coiled/context.py,sha256=MXWsW0swdYU-x32U7NiM0xt-t65maiEO8rvsGGeScFw,4754
|
|
|
12
12
|
coiled/core.py,sha256=Cu6hKBXRWSztbpF8huAyU_1glnt1gacnO9vExvG-Cwo,110796
|
|
13
13
|
coiled/errors.py,sha256=5aXhNXgidMm0VgPYT3MZMwlHhRE57MeSmqAJFHYaa8Y,305
|
|
14
14
|
coiled/exceptions.py,sha256=jUXgmfO0LitGe8ztSmAlzb9eQV3X5c0kNO2BwtEDTYg,3099
|
|
15
|
-
coiled/filestore.py,sha256=
|
|
15
|
+
coiled/filestore.py,sha256=0WKjjZVAJ2yxA1Oldfc1pUxj391aEAiSDtbC8qJCMvA,13445
|
|
16
16
|
coiled/function.py,sha256=pONtcTUDRr0dykhVV73AWXqU_pb-4-lvOA0tR3i_PlA,21654
|
|
17
17
|
coiled/plugins.py,sha256=w03H2Sck54QmwrVOM1BVscNiVeQsHyGm1yWNzPPPWKs,3424
|
|
18
18
|
coiled/prefect.py,sha256=j1EOg7Xuw82TNRonAGEoZ3ANlwN8GM5aDXRYSjC0lnA,1497
|
|
@@ -31,7 +31,7 @@ coiled/cli/core.py,sha256=Yw5g-Y7p75a3k3tVa_jbVhzR6xDyOqwO2yOEB6npUzk,1125
|
|
|
31
31
|
coiled/cli/curl.py,sha256=N5i-xUMGpP7PH-iGv02rxTWQGWlTtU8eLBQkqsMGCw4,1472
|
|
32
32
|
coiled/cli/diagnostics.py,sha256=1jIeue7xLOaf7LQFsNc6NmO5yU1jqmPFpKZSKjGN4rs,394
|
|
33
33
|
coiled/cli/env.py,sha256=NHh7ZSq9yfongkpFqzon1eLhnH1FwToVvkKFIhqXRBE,6932
|
|
34
|
-
coiled/cli/file.py,sha256=
|
|
34
|
+
coiled/cli/file.py,sha256=fJmOG3YhxpxXokGYu90wpjdwkJpp1XVqPJ_iveb5ShA,3623
|
|
35
35
|
coiled/cli/login.py,sha256=cByVXmMsfGEuY2TkYU_Y8zq1zVTUHAxOe_wpw2uHsBs,2242
|
|
36
36
|
coiled/cli/package_sync.py,sha256=lABDY20yjfLYGfPlQu8ugI-Q8doY4JtN8_0nb9PkcT4,4101
|
|
37
37
|
coiled/cli/prefect.py,sha256=T-SSFey4jlA_jpEI0DqAhVIPwlt2GvBFogEqYCwwevI,302
|
|
@@ -56,7 +56,7 @@ coiled/cli/cluster/metrics.py,sha256=mzMEYNX3LvDTXMEf8tBR3qGyHNN7wOBBhiWRGMPmlMA
|
|
|
56
56
|
coiled/cli/cluster/ssh.py,sha256=ylUw_Gpco9v4w9ktBXq1eIkVIGm4OyJ73vR681Ib-QA,12276
|
|
57
57
|
coiled/cli/cluster/utils.py,sha256=APKvldmBxXaxmEmKz8rV0_W-o1plF9FKAGGsWgIQxJU,1623
|
|
58
58
|
coiled/cli/hello/__init__.py,sha256=iKYsdmn4CNN5LR6vC7emMHuA9D578GkS2yRz-CTsClk,188
|
|
59
|
-
coiled/cli/hello/hello.py,sha256=
|
|
59
|
+
coiled/cli/hello/hello.py,sha256=jiFZuuGHS8rmk3vlEKF6S8-Dikzb5AUHL9rJeBlcn0o,11127
|
|
60
60
|
coiled/cli/hello/utils.py,sha256=4hwBsv0z6p0nnWWEtPGpFRJNrWZYtdm4ZOS_UNUU7ZY,8427
|
|
61
61
|
coiled/cli/hello/examples/__init__.py,sha256=YYvvsblGjJ36AbTv9B2FPM2yvzLNSMBIMeM38yVI_EM,313
|
|
62
62
|
coiled/cli/hello/examples/exit.py,sha256=H-gWgjZtT2ZGwSJu1mRTu8wr0r_bC-WvIXpZlDIz-0E,178
|
|
@@ -94,8 +94,8 @@ coiled/v2/widgets/__init__.py,sha256=Bt3GHTTyri-kFUaqGRVydDM-sCg5NdNujDg2RyvgV8U
|
|
|
94
94
|
coiled/v2/widgets/interface.py,sha256=YeMQ5qdRbbpM04x9qIg2LE1xwxyRxFbdDYnkrwHazPk,301
|
|
95
95
|
coiled/v2/widgets/rich.py,sha256=3rU5-yso92NdeEh3uSvEE-GwPNyp6i0Nb5PE5czXCik,28974
|
|
96
96
|
coiled/v2/widgets/util.py,sha256=Y8qpGqwNzqfCzgyRFRy7vcscBoXqop-Upi4HLPpXLgg,3120
|
|
97
|
-
coiled-1.125.
|
|
98
|
-
coiled-1.125.
|
|
99
|
-
coiled-1.125.
|
|
100
|
-
coiled-1.125.
|
|
101
|
-
coiled-1.125.
|
|
97
|
+
coiled-1.125.1.dev2.dist-info/METADATA,sha256=r-YFMAOq9YNiYbo23BJ6kvVkQrzcZ8mIUcCCZGyE24A,2181
|
|
98
|
+
coiled-1.125.1.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
99
|
+
coiled-1.125.1.dev2.dist-info/entry_points.txt,sha256=C8dz1ST_bTlTO-kNvuHBJQma9PyJPotg0S4xpPt5aHY,47
|
|
100
|
+
coiled-1.125.1.dev2.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
101
|
+
coiled-1.125.1.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|