Skip to content

Commit 3e994a5

Browse files
committed
Dump condor_ce_trace held job reasons
1 parent cb6ace8 commit 3e994a5

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

osgtest/tests/test_550_condorce.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,33 @@ 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, stdout, stderr = core.system(self.command, user=True)
52+
os.chdir(cwd)
53+
54+
if trace_rc:
55+
msg = 'condor_ce_trace failed'
56+
if stdout.find(', was held'):
57+
msg = 'condor_ce_trace job held'
58+
_, hold_out, hold_err = core.system(('condor_ce_q', '-held'))
59+
stdout += hold_out
60+
stderr += hold_err
61+
self.fail(core.diagnose(msg, self.command, trace_rc, stdout, stderr))
62+
63+
return stdout, stderr
64+
4365
def run_blahp_trace(self, lrms):
4466
"""Run condor_ce_trace() against a non-HTCondor backend and verify the cache"""
4567
lrms_cache_prefix = {'pbs': 'qstat', 'slurm': 'slurm'}
4668

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)
69+
trace_out, _ = self.run_trace(f'-a osgTestBatchSystem = {lrms.lower()}')
5470

5571
try:
5672
backend_jobid = re.search(r'%s_JOBID=(\d+)' % lrms.upper(), trace_out).group(1)
@@ -86,8 +102,6 @@ def run_blahp_trace(self, lrms):
86102
self.assertTrue(re.search(r'BatchJobId[=\s"\'p1S]+%s' % backend_jobid, cache),
87103
'Job %s not found in %s blahp cache:\n%s' % (backend_jobid, lrms.upper(), cache))
88104

89-
os.chdir(cwd)
90-
91105
def test_01_status(self):
92106
command = ('condor_ce_status', '-any')
93107
core.check_system(command, 'ce status', user=True)
@@ -105,14 +119,8 @@ def test_03_ping(self):
105119
def test_04_trace(self):
106120
self.check_schedd_ready()
107121
self.check_write_creds()
122+
self.run_trace()
108123

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)
116124

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

0 commit comments

Comments
 (0)