@@ -344,7 +344,8 @@ def start(self):
344344 # be interrupted at the next yield, and self.stop() will be called.
345345 # So this function should not return unless successful, and if unsuccessful
346346 # should either raise and Exception or loop forever.
347- assert len (self .job_id ) > 0
347+ if len (self .job_id ) == 0 :
348+ raise RuntimeError ("Jupyter batch job submission failure (no jobid in output)" )
348349 while True :
349350 yield self .poll ()
350351 if self .state_isrunning ():
@@ -355,7 +356,9 @@ def start(self):
355356 else :
356357 self .log .warn ('Job ' + self .job_id + ' neither pending nor running.\n ' +
357358 self .job_status )
358- assert self .state_ispending ()
359+ raise RuntimeError ('The Jupyter batch job has disappeared '
360+ ' while pending in the queue or died immediately '
361+ ' after starting.' )
359362 yield gen .sleep (self .startup_poll_interval )
360363
361364 self .current_ip = self .state_gethost ()
@@ -425,19 +428,19 @@ class BatchSpawnerRegexStates(BatchSpawnerBase):
425428 See Python docs: re.match.expand""" ).tag (config = True )
426429
427430 def state_ispending (self ):
428- assert self .state_pending_re
431+ assert self .state_pending_re , "Misconfigured: define state_running_re"
429432 if self .job_status and re .search (self .state_pending_re , self .job_status ):
430433 return True
431434 else : return False
432435
433436 def state_isrunning (self ):
434- assert self .state_running_re
437+ assert self .state_running_re , "Misconfigured: define state_running_re"
435438 if self .job_status and re .search (self .state_running_re , self .job_status ):
436439 return True
437440 else : return False
438441
439442 def state_gethost (self ):
440- assert self .state_exechost_re
443+ assert self .state_exechost_re , "Misconfigured: define state_exechost_re"
441444 match = re .search (self .state_exechost_re , self .job_status )
442445 if not match :
443446 self .log .error ("Spawner unable to match host addr in job status: " + self .job_status )
0 commit comments