@@ -168,6 +168,9 @@ def _req_keepvars_default(self):
168
168
# Will get the address of the server as reported by job manager
169
169
current_ip = Unicode ()
170
170
171
+ # Will get the port of the server as reported by singleserver
172
+ current_port = Integer ()
173
+
171
174
# Prepare substitution variables for templates using req_xyz traits
172
175
def get_req_subvars (self ):
173
176
reqlist = [ t for t in self .trait_names () if t .startswith ('req_' ) ]
@@ -346,7 +349,9 @@ def poll(self):
346
349
@gen .coroutine
347
350
def start (self ):
348
351
"""Start the process"""
349
- self .port = self .server .port = 0
352
+ if self .server :
353
+ self .server .port = self .port
354
+
350
355
job = yield self .submit_batch_script ()
351
356
352
357
# We are called with a timeout, and if the timeout expires this function will
@@ -371,19 +376,19 @@ def start(self):
371
376
yield gen .sleep (self .startup_poll_interval )
372
377
373
378
self .current_ip = self .state_gethost ()
374
- while self .port == 0 :
379
+ while self .current_port == 0 :
375
380
yield gen .sleep (self .startup_poll_interval )
376
381
377
382
if jupyterhub .version_info < (0 ,7 ):
378
383
# store on user for pre-jupyterhub-0.7:
379
- self .user .server .port = self .port
384
+ self .user .server .port = self .current_port
380
385
self .user .server .ip = self .current_ip
381
386
self .db .commit ()
382
387
self .log .info ("Notebook server job {0} started at {1}:{2}" .format (
383
- self .job_id , self .current_ip , self .port )
388
+ self .job_id , self .current_ip , self .current_port )
384
389
)
385
390
386
- return self .current_ip , self .port
391
+ return self .current_ip , self .current_port
387
392
388
393
@gen .coroutine
389
394
def stop (self , now = False ):
0 commit comments