Skip to content

Add try-except propagation status fails #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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