coiled 1.102.2.dev1__py3-none-any.whl → 1.102.2.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.
- coiled/cli/batch/__init__.py +2 -0
- coiled/cli/batch/logs.py +62 -0
- coiled/cli/cluster/better_logs.py +5 -0
- {coiled-1.102.2.dev1.dist-info → coiled-1.102.2.dev2.dist-info}/METADATA +1 -1
- {coiled-1.102.2.dev1.dist-info → coiled-1.102.2.dev2.dist-info}/RECORD +8 -7
- {coiled-1.102.2.dev1.dist-info → coiled-1.102.2.dev2.dist-info}/WHEEL +0 -0
- {coiled-1.102.2.dev1.dist-info → coiled-1.102.2.dev2.dist-info}/entry_points.txt +0 -0
- {coiled-1.102.2.dev1.dist-info → coiled-1.102.2.dev2.dist-info}/licenses/LICENSE +0 -0
coiled/cli/batch/__init__.py
CHANGED
|
@@ -2,6 +2,7 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from ..utils import CONTEXT_SETTINGS
|
|
4
4
|
from .list import batch_list_cli
|
|
5
|
+
from .logs import batch_logs_cli
|
|
5
6
|
from .run import batch_run_cli
|
|
6
7
|
from .status import batch_status_cli
|
|
7
8
|
from .wait import batch_wait_cli
|
|
@@ -19,4 +20,5 @@ def batch_group():
|
|
|
19
20
|
batch_group.add_command(batch_run_cli, "run")
|
|
20
21
|
batch_group.add_command(batch_status_cli, "status")
|
|
21
22
|
batch_group.add_command(batch_list_cli, "list")
|
|
23
|
+
batch_group.add_command(batch_logs_cli, "logs")
|
|
22
24
|
batch_group.add_command(batch_wait_cli, "wait")
|
coiled/cli/batch/logs.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from ..cluster.better_logs import better_logs
|
|
6
|
+
from ..utils import CONTEXT_SETTINGS
|
|
7
|
+
from .status import get_job_status
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.command(context_settings=CONTEXT_SETTINGS)
|
|
11
|
+
@click.argument("cluster", default="", required=False)
|
|
12
|
+
@click.option(
|
|
13
|
+
"--workspace",
|
|
14
|
+
default=None,
|
|
15
|
+
help="Coiled workspace (uses default workspace if not specified).",
|
|
16
|
+
)
|
|
17
|
+
@click.option(
|
|
18
|
+
"--task",
|
|
19
|
+
type=int,
|
|
20
|
+
default=None,
|
|
21
|
+
)
|
|
22
|
+
def batch_logs_cli(
|
|
23
|
+
cluster,
|
|
24
|
+
workspace,
|
|
25
|
+
task,
|
|
26
|
+
):
|
|
27
|
+
jobs, cluster_id = get_job_status(cluster=cluster, workspace=workspace)
|
|
28
|
+
instance_labels_dict = {}
|
|
29
|
+
show_all_instances = task is not None
|
|
30
|
+
|
|
31
|
+
if not jobs:
|
|
32
|
+
raise ValueError(f"No jobs assigned to cluster {cluster}")
|
|
33
|
+
|
|
34
|
+
if task:
|
|
35
|
+
job_id = None
|
|
36
|
+
vm_id = None
|
|
37
|
+
|
|
38
|
+
for job in jobs:
|
|
39
|
+
for job_task in job.get("tasks", []):
|
|
40
|
+
if job_task.get("array_task_id") == task:
|
|
41
|
+
job_id = job["id"]
|
|
42
|
+
vm_id = job_task.get("assigned_to_id")
|
|
43
|
+
instance_labels_dict[vm_id] = {"label": f"Task {job_task['array_task_id']}", "color": "blue"}
|
|
44
|
+
break
|
|
45
|
+
if vm_id:
|
|
46
|
+
break
|
|
47
|
+
|
|
48
|
+
if not vm_id:
|
|
49
|
+
raise ValueError(f"Task {task} was not found or is not yet running")
|
|
50
|
+
|
|
51
|
+
log_filter = f"__BATCH {job_id}.{task}__"
|
|
52
|
+
else:
|
|
53
|
+
job_id = jobs[0]["id"]
|
|
54
|
+
log_filter = f"__BATCH {job_id}."
|
|
55
|
+
|
|
56
|
+
better_logs(
|
|
57
|
+
cluster_id=cluster_id,
|
|
58
|
+
instance_labels_dict=instance_labels_dict,
|
|
59
|
+
show_label=not show_all_instances,
|
|
60
|
+
show_all_instances=show_all_instances,
|
|
61
|
+
filter=log_filter,
|
|
62
|
+
)
|
|
@@ -400,6 +400,11 @@ def format_log_event(
|
|
|
400
400
|
if event.get("instance_id") and event.get("instance_id") in instances:
|
|
401
401
|
label = instances[event["instance_id"]]["label"]
|
|
402
402
|
color = instances[event["instance_id"]]["color"]
|
|
403
|
+
elif event.get("task_id") is not None:
|
|
404
|
+
task_id = event["task_id"]
|
|
405
|
+
# for batch job tasks, use task ID as the label
|
|
406
|
+
label = f"Task {task_id}"
|
|
407
|
+
color = COLORS[task_id % len(COLORS)]
|
|
403
408
|
else:
|
|
404
409
|
# we might not know about instance if it showed up while we're tailing all worker logs
|
|
405
410
|
label = event.get("instance_id") or event.get("instance")
|
|
@@ -37,14 +37,15 @@ coiled/cli/prefect_serve.py,sha256=gemq6YOVbnBoq4k3tSaU2gFJR3aMSxXLNxH6jB8V3n8,4
|
|
|
37
37
|
coiled/cli/run.py,sha256=VX3R_iY1S-qGEA7p7RxpX-w46CceLJd-LdTP7tojraY,29116
|
|
38
38
|
coiled/cli/sync.py,sha256=S5PzB9GSPJn3HvviOMLKVbo4ET46FlPwLYK_7sRyonQ,9726
|
|
39
39
|
coiled/cli/utils.py,sha256=cp7ToFGRpUKi6iNL6BbLjzgrgeTYSX_C55lYhaKWHHA,3479
|
|
40
|
-
coiled/cli/batch/__init__.py,sha256=
|
|
40
|
+
coiled/cli/batch/__init__.py,sha256=539CnfnqqcW7ndSufTS-Ie5FGZiElMYxE0Ptu70wo8M,660
|
|
41
41
|
coiled/cli/batch/list.py,sha256=lU3mXeKUHltzpdbo7Txcd64T1-XpHE-wxTFIBoTR28w,3300
|
|
42
|
+
coiled/cli/batch/logs.py,sha256=8m1YNwQiSwmZ2KWi9-UVDVpXk5EDr2xgnbYuq6KhVeU,1692
|
|
42
43
|
coiled/cli/batch/run.py,sha256=Yld1MeBnr95XnmYqdERguJMaGk72_yRWvFR7FK9-77w,24738
|
|
43
44
|
coiled/cli/batch/status.py,sha256=cSpMRC0YHFQ18y-XEXFjTOza_OTd7mtT-NX7sRSLMhk,4193
|
|
44
45
|
coiled/cli/batch/wait.py,sha256=qe9Tk3ccjijVlpr8jhPaKoPdvLtA8wkyss50QA4z1Do,3559
|
|
45
46
|
coiled/cli/cluster/__init__.py,sha256=dKmYCta0r2EsW0FlPu8GM_bqWl8obskEc5xM332Dw4k,716
|
|
46
47
|
coiled/cli/cluster/azure_logs.py,sha256=6CPoAm5PZue56gjGL8eQBBNklebyW48OLjhLOFXL4cA,1990
|
|
47
|
-
coiled/cli/cluster/better_logs.py,sha256=
|
|
48
|
+
coiled/cli/cluster/better_logs.py,sha256=Bl57LDEzL6hJqWDlHUqsafi9sl5JBtOzrtlvP9Er8Lk,14823
|
|
48
49
|
coiled/cli/cluster/crud.py,sha256=32zBGfRvrFEbeEgGuGRHU1PH5x1yv9g_KRpeQjoSK_U,916
|
|
49
50
|
coiled/cli/cluster/get_address.py,sha256=1LYTh9P7lKk7Tjpe4Yv_nZ4HtOZii2pXS5Nm0InSJAA,1625
|
|
50
51
|
coiled/cli/cluster/list.py,sha256=4k4ThFKLJBI9oeyi_pc-s8uxYlx9FordyCgsR5LI6Vg,1561
|
|
@@ -91,8 +92,8 @@ coiled/v2/widgets/__init__.py,sha256=Bt3GHTTyri-kFUaqGRVydDM-sCg5NdNujDg2RyvgV8U
|
|
|
91
92
|
coiled/v2/widgets/interface.py,sha256=YeMQ5qdRbbpM04x9qIg2LE1xwxyRxFbdDYnkrwHazPk,301
|
|
92
93
|
coiled/v2/widgets/rich.py,sha256=3rU5-yso92NdeEh3uSvEE-GwPNyp6i0Nb5PE5czXCik,28974
|
|
93
94
|
coiled/v2/widgets/util.py,sha256=Y8qpGqwNzqfCzgyRFRy7vcscBoXqop-Upi4HLPpXLgg,3120
|
|
94
|
-
coiled-1.102.2.
|
|
95
|
-
coiled-1.102.2.
|
|
96
|
-
coiled-1.102.2.
|
|
97
|
-
coiled-1.102.2.
|
|
98
|
-
coiled-1.102.2.
|
|
95
|
+
coiled-1.102.2.dev2.dist-info/METADATA,sha256=90-FDEPKThd4CoclSFaIdlqycTDemq-FmR-nm2KDQhE,2192
|
|
96
|
+
coiled-1.102.2.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
97
|
+
coiled-1.102.2.dev2.dist-info/entry_points.txt,sha256=C8dz1ST_bTlTO-kNvuHBJQma9PyJPotg0S4xpPt5aHY,47
|
|
98
|
+
coiled-1.102.2.dev2.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
99
|
+
coiled-1.102.2.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|