Skip to content

Commit

Permalink
Add try-except propagation status fails (#308)
Browse files Browse the repository at this point in the history
* Add try-except propagation status fails
* Add details to subject
* Fix recipient for postrun failure
* Add node_hostname to subject
  • Loading branch information
jwokaty authored Jun 23, 2023
1 parent 18d6d35 commit b9ce223
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions BBS-make-PROPAGATION_STATUS_DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import time
import subprocess

import bbs.notify

import BBSutils
import BBSvars
import BBSbase
Expand All @@ -30,8 +32,23 @@ def make_PROPAGATION_STATUS_DB(final_repo):
## subprocess.run() if this code is runned by the Task Scheduler
## on Windows (the child process tends to almost always return an
## error). Apparently using 'stderr=subprocess.STDOUT' fixes this pb.
subprocess.run(cmd, stdout=None, stderr=subprocess.STDOUT, shell=True,
check=True)
try:
subprocess.run(cmd, stdout=None, stderr=subprocess.STDOUT, shell=True,
check=True)
except subprocess.CalledProcessError as e:
subject = (f"[BBS] Postrun failure on {BBSvars.node_hostname} for "
f"{BBSvars.bioc_version} {BBSvars.buildtype} builds")
msg_body = f"""\
Postrun failed on {BBSvars.node_hostname} for the {BBSvars.bioc_version}
{BBSvars.buildtype} builds with the following error:
Error: {e}"""
bbs.notify.mode = "do-it"
bbs.notify.sendtextmail("[email protected]",
["[email protected]"],
subject,
msg_body)
raise e
return

##############################################################################
Expand Down

0 comments on commit b9ce223

Please sign in to comment.