@@ -40,17 +40,33 @@ def check_schedd_ready(self):
40
40
"""
41
41
self .skip_bad_unless (core .state ['condor-ce.schedd-ready' ], 'CE schedd not ready to accept jobs' )
42
42
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
+
43
65
def run_blahp_trace (self , lrms ):
44
66
"""Run condor_ce_trace() against a non-HTCondor backend and verify the cache"""
45
67
lrms_cache_prefix = {'pbs' : 'qstat' , 'slurm' : 'slurm' }
46
68
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 ()} ' )
54
70
55
71
try :
56
72
backend_jobid = re .search (r'%s_JOBID=(\d+)' % lrms .upper (), trace_out ).group (1 )
@@ -86,8 +102,6 @@ def run_blahp_trace(self, lrms):
86
102
self .assertTrue (re .search (r'BatchJobId[=\s"\'p1S]+%s' % backend_jobid , cache ),
87
103
'Job %s not found in %s blahp cache:\n %s' % (backend_jobid , lrms .upper (), cache ))
88
104
89
- os .chdir (cwd )
90
-
91
105
def test_01_status (self ):
92
106
command = ('condor_ce_status' , '-any' )
93
107
core .check_system (command , 'ce status' , user = True )
@@ -105,14 +119,8 @@ def test_03_ping(self):
105
119
def test_04_trace (self ):
106
120
self .check_schedd_ready ()
107
121
self .check_write_creds ()
122
+ self .run_trace ()
108
123
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 )
116
124
117
125
def test_05_pbs_trace (self ):
118
126
core .skip_ok_unless_installed ('torque-mom' , 'torque-server' , 'torque-scheduler' , 'torque-client' , 'munge' ,
0 commit comments