@@ -165,12 +165,6 @@ def _req_keepvars_default(self):
165
165
# Will get the raw output of the job status command unless overridden
166
166
job_status = Unicode ()
167
167
168
- # Will get the address of the server as reported by job manager
169
- current_ip = Unicode ()
170
-
171
- # Will get the port of the server as reported by singleserver
172
- current_port = Integer ()
173
-
174
168
# Prepare substitution variables for templates using req_xyz traits
175
169
def get_req_subvars (self ):
176
170
reqlist = [ t for t in self .trait_names () if t .startswith ('req_' ) ]
@@ -349,6 +343,9 @@ def poll(self):
349
343
@gen .coroutine
350
344
def start (self ):
351
345
"""Start the process"""
346
+ self .ip = self .traits ()['ip' ].default_value
347
+ self .port = self .traits ()['port' ].default_value
348
+
352
349
if jupyterhub .version_info >= (0 ,8 ) and self .server :
353
350
self .server .port = self .port
354
351
@@ -375,20 +372,20 @@ def start(self):
375
372
' after starting.' )
376
373
yield gen .sleep (self .startup_poll_interval )
377
374
378
- self .current_ip = self .state_gethost ()
379
- while self .current_port == 0 :
375
+ self .ip = self .state_gethost ()
376
+ while self .port == 0 :
380
377
yield gen .sleep (self .startup_poll_interval )
381
378
382
379
if jupyterhub .version_info < (0 ,7 ):
383
380
# store on user for pre-jupyterhub-0.7:
384
- self .user .server .port = self .current_port
385
- self .user .server .ip = self .current_ip
381
+ self .user .server .port = self .port
382
+ self .user .server .ip = self .ip
386
383
self .db .commit ()
387
384
self .log .info ("Notebook server job {0} started at {1}:{2}" .format (
388
- self .job_id , self .current_ip , self .current_port )
385
+ self .job_id , self .ip , self .port )
389
386
)
390
387
391
- return self .current_ip , self .current_port
388
+ return self .ip , self .port
392
389
393
390
@gen .coroutine
394
391
def stop (self , now = False ):
@@ -408,7 +405,7 @@ def stop(self, now=False):
408
405
yield gen .sleep (1.0 )
409
406
if self .job_id :
410
407
self .log .warn ("Notebook server job {0} at {1}:{2} possibly failed to terminate" .format (
411
- self .job_id , self .current_ip , self .port )
408
+ self .job_id , self .ip , self .port )
412
409
)
413
410
414
411
0 commit comments