Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Statuslogger not handling unparseable logs correctly (#66)
Browse files Browse the repository at this point in the history
* handle missing start and end more gracefully in statuslogger
* better handling of unparseable logs
  • Loading branch information
rsds143 authored May 26, 2021
1 parent bbbb392 commit fd7e04e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pysper/core/statuslogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,16 @@ def __init__(self, nodes):
print(nodes)
self.nodes = nodes
if nodes:
self.start = min([n.start for n in nodes.values() if n.start])
self.end = max([n.end for n in nodes.values() if n.end])
self.duration = self.end - self.start
start_times = [n.start for n in nodes.values() if n.start]
if len(start_times) > 0:
self.start = min(start_times)
end_times = [n.end for n in nodes.values() if n.end]
if len(end_times) > 0:
self.end = max(end_times)
if hasattr(self, "end") and hasattr(self, "start"):
self.duration = self.end - self.start
else:
self.start, self.end, self.duration = 0, 0, 0
else:
self.start, self.end, self.duration = 0, 0, 0
self.lines = sum([n.lines for n in nodes.values()])
Expand Down

0 comments on commit fd7e04e

Please sign in to comment.