Skip to content

Commit

Permalink
Show correct status in short dash after early stop
Browse files Browse the repository at this point in the history
  • Loading branch information
breuleux authored and Delaunay committed May 2, 2023
1 parent a3d8e4d commit 955ce31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion milabench/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def __init__(self):
self.live = Live(self.panel, refresh_per_second=4, console=self.console)
self.rows = defaultdict(dict)
self.endtimes = {}
self.early_stop = {}

def prune(self):
now = time.time()
Expand Down Expand Up @@ -231,6 +232,9 @@ def __call__(self, entry):
if method:
method(entry, data, row)

def on_stop(self, entry, data, row):
self.early_stop[entry.tag] = True

def on_end(self, entry, data, row):
self.endtimes[entry.tag] = time.time()

Expand Down Expand Up @@ -305,7 +309,7 @@ def on_error(self, entry, data, row):
def on_end(self, entry, data, row):
super().on_end(entry, data, row)
rc = data["return_code"]
if rc == 0:
if rc == 0 or self.early_stop.get(entry.tag, False):
row["status"] = Text("COMPLETED", style="bold green")
else:
row["status"] = Text(f"FAIL:{rc}", style="bold red")
Expand Down

0 comments on commit 955ce31

Please sign in to comment.