##// END OF EJS Templates
print info string on interrupt, log it on startup
Paul Ivanov -
Show More
@@ -139,5 +139,5 b' class AzureNotebookManager(NotebookManager):'
139 139 else:
140 140 self.delete_notebook_id(notebook_id)
141 141
142 def log_info(self):
143 self.log.info("Serving notebooks from Azure storage: %s, %s", self.account_name, self.container)
142 def info_string(self):
143 return "Serving notebooks from Azure storage: %s, %s" % (self.account_name, self.container)
@@ -191,6 +191,6 b' class FileNotebookManager(NotebookManager):'
191 191 else:
192 192 i = i+1
193 193 return name
194
195 def log_info(self):
196 self.log.info("Serving notebooks from local directory: %s", self.notebook_dir)
194
195 def info_string(self):
196 return "Serving notebooks from local directory: %s" % self.notebook_dir
@@ -207,4 +207,8 b' class NotebookManager(LoggingConfigurable):'
207 207 return notebook_id
208 208
209 209 def log_info(self):
210 self.log.info("Serving notebooks") No newline at end of file
210 self.log.info(self.info_string())
211
212 def info_string(self):
213 return "Serving notebooks"
214
@@ -581,8 +581,8 b' class NotebookApp(BaseIPythonApplication):'
581 581 time.sleep(0.1)
582 582 info = self.log.info
583 583 info('interrupted')
584 self.print_notebook_info()
585 info("Shutdown this notebook server (y/[n])? ")
584 print self.notebook_info()
585 sys.stdout.write("Shutdown this notebook server (y/[n])? ")
586 586 sys.stdout.flush()
587 587 r,w,x = select.select([sys.stdin], [], [], 5)
588 588 if r:
@@ -605,7 +605,7 b' class NotebookApp(BaseIPythonApplication):'
605 605 ioloop.IOLoop.instance().stop()
606 606
607 607 def _signal_info(self, sig, frame):
608 self.print_notebook_info()
608 print self.notebook_info()
609 609
610 610 @catch_config_error
611 611 def initialize(self, argv=None):
@@ -624,10 +624,10 b' class NotebookApp(BaseIPythonApplication):'
624 624 self.log.info('Shutting down kernels')
625 625 self.kernel_manager.shutdown_all()
626 626
627 def print_notebook_info(self):
628 "Print the current working directory and the server url information"
629 self.notebook_manager.log_info()
630 self.log.info("The IPython Notebook is running at: %s" % self._url)
627 def notebook_info(self):
628 "Return the current working directory and the server url information"
629 mgr_info = self.notebook_manager.info_string() + "\n"
630 return mgr_info +"The IPython Notebook is running at: %s" % self._url
631 631
632 632 def start(self):
633 633 """ Start the IPython Notebok server app, after initialization
@@ -639,7 +639,8 b' class NotebookApp(BaseIPythonApplication):'
639 639 info = self.log.info
640 640 self._url = "%s://%s:%i%s" % (proto, ip, self.port,
641 641 self.base_project_url)
642 self.print_notebook_info()
642 for line in self.notebook_info().split("\n"):
643 info(line)
643 644 info("Use Control-C to stop this server and shut down all kernels.")
644 645
645 646 if self.open_browser or self.file_to_run:
General Comments 0
You need to be logged in to leave comments. Login now