Skip to content

Commit

Permalink
added try-except (as non-null exit codes raise errors)
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Jul 19, 2017
1 parent 0d87b1c commit 1e340c7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cluster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ def detect_cluster_system():
:return: string "SBE", "PBS" or "other"
"""
which_output = check_output(["which", "sge_qmaster"]).decode("utf-8")
try:
which_output = check_output(["which", "sge_qmaster"]).decode("utf-8")

if "/sge_qmaster" in which_output:
return "SGE"
if "/sge_qmaster" in which_output:
return "SGE"
except Exception as _:
pass

which_output = check_output(["which", "pbs_sched"]).decode("utf-8")
try:
which_output = check_output(["which", "pbs_sched"]).decode("utf-8")

if "/pbs_sched" in which_output:
return "PBS"
if "/pbs_sched" in which_output:
return "PBS"
except Exception as _:
pass

return "other"

Expand Down

0 comments on commit 1e340c7

Please sign in to comment.