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