@@ -344,7 +344,8 @@ def start(self):
344
344
# be interrupted at the next yield, and self.stop() will be called.
345
345
# So this function should not return unless successful, and if unsuccessful
346
346
# 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)" )
348
349
while True :
349
350
yield self .poll ()
350
351
if self .state_isrunning ():
@@ -355,7 +356,9 @@ def start(self):
355
356
else :
356
357
self .log .warn ('Job ' + self .job_id + ' neither pending nor running.\n ' +
357
358
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.' )
359
362
yield gen .sleep (self .startup_poll_interval )
360
363
361
364
self .current_ip = self .state_gethost ()
@@ -425,19 +428,19 @@ class BatchSpawnerRegexStates(BatchSpawnerBase):
425
428
See Python docs: re.match.expand""" ).tag (config = True )
426
429
427
430
def state_ispending (self ):
428
- assert self .state_pending_re
431
+ assert self .state_pending_re , "Misconfigured: define state_running_re"
429
432
if self .job_status and re .search (self .state_pending_re , self .job_status ):
430
433
return True
431
434
else : return False
432
435
433
436
def state_isrunning (self ):
434
- assert self .state_running_re
437
+ assert self .state_running_re , "Misconfigured: define state_running_re"
435
438
if self .job_status and re .search (self .state_running_re , self .job_status ):
436
439
return True
437
440
else : return False
438
441
439
442
def state_gethost (self ):
440
- assert self .state_exechost_re
443
+ assert self .state_exechost_re , "Misconfigured: define state_exechost_re"
441
444
match = re .search (self .state_exechost_re , self .job_status )
442
445
if not match :
443
446
self .log .error ("Spawner unable to match host addr in job status: " + self .job_status )
0 commit comments