MCPcopy
hub / github.com/treeverse/dvc / run

Method run

dvc/commands/queue/status.py:14–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

12 """Show queue task and worker status."""
13
14 def run(self) -> int:
15 from dvc.repo.experiments.show import format_time
16
17 result = self.repo.experiments.celery_queue.status()
18 if result:
19 all_headers = ["Task", "Name", "Created", "Status"]
20 td = TabularData(all_headers)
21 for exp in result:
22 created = format_time(exp.get("timestamp"))
23 assert exp["rev"]
24 assert exp["status"]
25 td.append(
26 [
27 exp["rev"][:7],
28 exp.get("name") or "",
29 created,
30 exp["status"],
31 ]
32 )
33 td.render()
34 else:
35 ui.write("No experiment tasks in the queue.")
36 ui.write()
37
38 worker_status = self.repo.experiments.celery_queue.worker_status()
39 active_count = len([name for name, task in worker_status.items() if task])
40 idle_count = len(worker_status) - active_count
41
42 ui.write(f"Worker status: {active_count} active, {idle_count} idle")
43
44 return 0
45
46
47def add_parser(queue_subparsers, parent_parser):

Callers

nothing calls this directly

Calls 9

appendMethod · 0.95
renderMethod · 0.95
TabularDataClass · 0.90
format_timeFunction · 0.90
writeMethod · 0.80
worker_statusMethod · 0.80
itemsMethod · 0.80
statusMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected