Skip to content

Commit

Permalink
Create pippin_status.txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
OmegaLambda1998 committed Oct 5, 2023
1 parent dab4b88 commit f97a346
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pippin/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, filename, config_path, config_raw, config, message_store):
self.load_task_setup()

self.output_dir = os.path.join(get_output_dir(), self.filename)
self.dashboard = os.path.join(self.output_dir, "pippin_status.txt")
self.tasks = None
self.num_jobs_queue = 0
self.num_jobs_queue_gpu = 0
Expand Down Expand Up @@ -254,13 +255,13 @@ def get_dashboard_line(self, stage, tasks):
self.logger.info(output)
output = " " * 12
output += s + " "
self.logger.info(output)

return output

def print_dashboard(self):
all_tasks = self.tasks + self.running + self.done + self.failed + self.blocked


self.logger.info("-------------------")
self.logger.info("CURRENT TASK STATUS")

Expand All @@ -270,9 +271,23 @@ def print_dashboard(self):
for name, task_class in zip(Manager.stages, Manager.task_order):
tasks = self.get_subtasks(task_class, all_tasks)
if tasks:
self.get_dashboard_line(name, tasks)
self.logger.info(self.get_dashboard_line(name, tasks))

self.logger.info("-------------------")
try:
with open(self.dashboard, 'w') as f:
f.write("-------------------\n")
f.write("CURRENT TASK STATUS\n")

options = ["WAITING", "RUNNING", "DONE", "FAILED", "BLOCKED"]
header = "Key: " + " ".join([self.get_string_with_colour(o, o.lower()) for o in options])
f.write(header + "\n")
for name, task_class in zip(Manager.stages, Manager.task_order):
tasks = self.get_subtasks(task_class, all_tasks)
if tasks:
f.write(self.get_dashboard_line(name, tasks) + "\n")
except:
self.logger.warning(f"Error opening {self.dashboard}")

def compress_all(self):
for t in self.tasks:
Expand Down

0 comments on commit f97a346

Please sign in to comment.