@@ -187,23 +187,34 @@ async def run_command(self, cmd, input=None, env=None):
187
187
if input :
188
188
inbytes = input .encode ()
189
189
190
- out , eout = await proc .communicate (input = inbytes )
191
-
192
- eout = eout .decode ().strip ()
193
-
194
- err = proc .returncode
195
-
196
- if err != 0 :
197
- self .log .error ("Subprocess returned exitcode %s" % err )
198
- self .log .error (eout )
199
- raise RuntimeError (eout )
190
+ try :
191
+ out , eout = await proc .communicate (input = inbytes )
192
+ except :
193
+ self .log .debug ("Exception raised when trying to run command: %s" % command )
194
+ proc .kill ()
195
+ self .log .debug ("Running command failed done kill" )
196
+ out , eout = await proc .communicate ()
197
+ out = out .decode .strip ()
198
+ eout = eout .decode .strip ()
199
+ self .log .debug ("Running command failed done communicate" )
200
+ self .log .debug ("Subprocess returned exitcode %s" % proc .returncode )
201
+ self .log .debug ("Subprocess returned standard output %s" % out )
202
+ self .log .debug ("Subprocess returned standard error %s" % eout )
203
+ raise
200
204
else :
201
- out = out .decode ().strip ()
202
- return out
205
+ eout = eout .decode ().strip ()
206
+ err = proc .returncode
207
+ if err != 0 :
208
+ self .log .error ("Subprocess returned exitcode %s" % err )
209
+ self .log .error (eout )
210
+ raise RuntimeError (eout )
211
+
212
+ out = out .decode ().strip ()
213
+ return out
203
214
204
215
async def _get_batch_script (self , ** subvars ):
205
216
"""Format batch script from vars"""
206
- # Colud be overridden by subclasses, but mainly useful for testing
217
+ # Could be overridden by subclasses, but mainly useful for testing
207
218
return format_template (self .batch_script , ** subvars )
208
219
209
220
async def submit_batch_script (self ):
0 commit comments