(self)
| 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 | |
| 47 | def add_parser(queue_subparsers, parent_parser): |
nothing calls this directly
no test coverage detected