Skip to content

Commit 274e82c

Browse files
authored
Merge pull request #217 from brianhlin/dump-ce-held-job-reasons
Dump CE held job reasons
2 parents cb6ace8 + ae247c5 commit 274e82c

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

osgtest/tests/test_550_condorce.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,35 @@ def check_schedd_ready(self):
4040
"""
4141
self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs')
4242

43+
def run_trace(self, *args):
44+
"""Run condor_ce_trace along with any additional *args. If trace completes with a held job, also return output
45+
from 'condor_ce_q -held'.
46+
"""
47+
48+
cwd = os.getcwd()
49+
os.chdir('/tmp')
50+
self.command += ['condor_ce_trace', '--debug'] + list(args) + [core.get_hostname()]
51+
trace_rc, trace_out, trace_err = core.system(self.command, user=True)
52+
os.chdir(cwd)
53+
54+
if trace_rc:
55+
msg = 'condor_ce_trace failed'
56+
if trace_out.find(', was held'):
57+
msg = 'condor_ce_trace job held'
58+
_, hold_out, hold_err = core.system(('condor_ce_q', '-held'))
59+
self.fail(core.diagnose(msg,
60+
self.command,
61+
trace_rc,
62+
str(trace_out) + str(hold_out),
63+
str(trace_err) + str(hold_err)))
64+
65+
return trace_out, trace_err
66+
4367
def run_blahp_trace(self, lrms):
4468
"""Run condor_ce_trace() against a non-HTCondor backend and verify the cache"""
4569
lrms_cache_prefix = {'pbs': 'qstat', 'slurm': 'slurm'}
4670

47-
cwd = os.getcwd()
48-
os.chdir('/tmp')
49-
self.command += ['condor_ce_trace',
50-
'-a osgTestBatchSystem = %s' % lrms.lower(),
51-
'--debug',
52-
core.get_hostname()]
53-
trace_out, _, _ = core.check_system(self.command, 'ce trace against %s' % lrms.lower(), user=True)
71+
trace_out, _ = self.run_trace(f'-a osgTestBatchSystem = {lrms.lower()}')
5472

5573
try:
5674
backend_jobid = re.search(r'%s_JOBID=(\d+)' % lrms.upper(), trace_out).group(1)
@@ -86,8 +104,6 @@ def run_blahp_trace(self, lrms):
86104
self.assertTrue(re.search(r'BatchJobId[=\s"\'p1S]+%s' % backend_jobid, cache),
87105
'Job %s not found in %s blahp cache:\n%s' % (backend_jobid, lrms.upper(), cache))
88106

89-
os.chdir(cwd)
90-
91107
def test_01_status(self):
92108
command = ('condor_ce_status', '-any')
93109
core.check_system(command, 'ce status', user=True)
@@ -105,14 +121,8 @@ def test_03_ping(self):
105121
def test_04_trace(self):
106122
self.check_schedd_ready()
107123
self.check_write_creds()
124+
self.run_trace()
108125

109-
cwd = os.getcwd()
110-
os.chdir('/tmp')
111-
112-
self.command += ['condor_ce_trace', '--debug', core.get_hostname()]
113-
core.check_system(self.command, 'ce trace', user=True)
114-
115-
os.chdir(cwd)
116126

117127
def test_05_pbs_trace(self):
118128
core.skip_ok_unless_installed('torque-mom', 'torque-server', 'torque-scheduler', 'torque-client', 'munge',

0 commit comments

Comments
 (0)