@@ -282,6 +282,7 @@ async def query_job_status(self):
282
282
try :
283
283
self .job_status = await self .run_command (cmd )
284
284
except RuntimeError as e :
285
+ # e.args[0] is stderr from the process
285
286
self .job_status = e .args [0 ]
286
287
except Exception as e :
287
288
self .log .error ('Error querying job ' + self .job_id )
@@ -343,7 +344,7 @@ def state_isrunning(self):
343
344
344
345
def state_isunknown (self ):
345
346
"Return boolean indicating if job state retrieval failed because of the resource manager"
346
- raise False
347
+ return None
347
348
348
349
def state_gethost (self ):
349
350
"Return string, hostname or addr of running job, likely by parsing self.job_status"
@@ -425,7 +426,7 @@ async def stop(self, now=False):
425
426
return
426
427
for i in range (10 ):
427
428
status = await self .query_job_status ()
428
- if not status in (JobStatus .RUNNING , JobStatus .UNKNOWN ):
429
+ if status not in (JobStatus .RUNNING , JobStatus .UNKNOWN ):
429
430
return
430
431
await gen .sleep (1.0 )
431
432
if self .job_id :
@@ -481,8 +482,9 @@ class BatchSpawnerRegexStates(BatchSpawnerBase):
481
482
If this variable is set, the match object will be expanded using this string
482
483
to obtain the notebook IP.
483
484
See Python docs: re.match.expand""" ).tag (config = True )
484
- state_unknown_re = Unicode ('^$' ,
485
- help = "Regex that matches job_status if the resource manager is not answering" ).tag (config = True )
485
+ state_unknown_re = Unicode ('' ,
486
+ help = "Regex that matches job_status if the resource manager is not answering."
487
+ "Blank indicates not used." ).tag (config = True )
486
488
487
489
def state_ispending (self ):
488
490
assert self .state_pending_re , "Misconfigured: define state_running_re"
@@ -493,8 +495,9 @@ def state_isrunning(self):
493
495
return self .job_status and re .search (self .state_running_re , self .job_status )
494
496
495
497
def state_isunknown (self ):
496
- assert self .state_unknown_re , "Misconfigured: define state_unknown_re"
497
- return self .job_status and re .search (self .state_unknown_re , self .job_status )
498
+ # Blank means "not set" and this function always returns None.
499
+ if self .state_unknown_re :
500
+ return self .job_status and re .search (self .state_unknown_re , self .job_status )
498
501
499
502
def state_gethost (self ):
500
503
assert self .state_exechost_re , "Misconfigured: define state_exechost_re"
0 commit comments