Skip to content

Commit

Permalink
fix status calc on non phase output
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMKuehne committed Apr 15, 2024
1 parent 4281e62 commit 3cd3f93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion embark/embark/logreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def phase_identify(status_message):
elif re.search(pattern=re.escape(failed_pattern), string=status_message["phase"]):
max_module = -2
phase_nmbr = EMBA_PHASE_CNT
else:
logger.info("Undefined pattern in logreader %s ", status_message["phase"])
logger.info("Not updating status percentage")
return max_module, phase_nmbr

# update our dict whenever a new module is being processed
Expand All @@ -146,12 +149,14 @@ def update_status(self, stream_item_list):
self.module_cnt = self.module_cnt % max_module # make sure it's in range
percentage = phase_nmbr * (100 / EMBA_PHASE_CNT) + ((100 / EMBA_PHASE_CNT) / max_module) * self.module_cnt # increments: F=6.25, S=0.65, L=3.57, P=1.25
else:
logger.debug("Undefined state in logreader %s ", self.status_msg)
logger.error("Undefined state in logreader %s ", self.status_msg)
percentage = self.status_msg["percentage"]

logger.debug("Status is %d, in phase %d, with modules %d", percentage, phase_nmbr, max_module)

# set attributes of current message
self.status_msg["module"] = stream_item_list[0]

# ignore all Q-modules for percentage calc
if not re.match(".*Q[0-9][0-9]", stream_item_list[0]):
self.status_msg["percentage"] = percentage
Expand Down

0 comments on commit 3cd3f93

Please sign in to comment.