Skip to content

Commit a108bea

Browse files
committed
Specific error raised when condor_q fails us
1 parent 2ab323c commit a108bea

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pyhdtoolkit/utils/htcondor.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ def __init__(self, line: str) -> None:
9797
super().__init__(errmsg)
9898

9999

100+
class CondorQError(ChildProcessError):
101+
"""Raised when executing the 'condor_q' command fails."""
102+
103+
def __init__(self) -> None:
104+
errmsg = "Checking htcondor status (condor_q) failed"
105+
super().__init__(errmsg)
106+
107+
100108
# ----- HTCondor Querying / Processing ----- #
101109

102110

@@ -113,15 +121,19 @@ def query_condor_q() -> str:
113121
str
114122
The utf-8 decoded string returned by the
115123
``condor_q`` command.
124+
125+
Raises
126+
------
127+
CondorQError
128+
If the ``condor_q`` command fails for any reason.
116129
"""
117130
return_code, raw_result = CommandLine.run("condor_q")
118131
condor_status = raw_result.decode().strip()
119132
if return_code == 0:
120133
return condor_status
121134

122135
# An issue occured, let's raise
123-
msg = "Checking htcondor status failed"
124-
raise ChildProcessError(msg)
136+
raise CondorQError()
125137

126138

127139
def read_condor_q(report: str) -> tuple[list[HTCTaskSummary], ClusterSummary]:

0 commit comments

Comments
 (0)