-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add try-except propagation status fails (#308)
* Add try-except propagation status fails * Add details to subject * Fix recipient for postrun failure * Add node_hostname to subject
- Loading branch information
Showing
1 changed file
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ | |
import time | ||
import subprocess | ||
|
||
import bbs.notify | ||
|
||
import BBSutils | ||
import BBSvars | ||
import BBSbase | ||
|
@@ -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 | ||
|
||
############################################################################## | ||
|