##// END OF EJS Templates
Add the unlink method to javascript links to maintain compatibility with traitlet links
Add the unlink method to javascript links to maintain compatibility with traitlet links

File last commit:

r11408:567bf7a0
r19390:e461f122
Show More
iploggerapp.py
95 lines | 2.8 KiB | text/x-python | PythonLexer
MinRK
Refactor newparallel to use Config system...
r3604 #!/usr/bin/env python
# encoding: utf-8
"""
A simple IPython logger application
MinRK
update recently changed modules with Authors in docstring
r4018
Authors:
* MinRK
MinRK
Refactor newparallel to use Config system...
r3604 """
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
import sys
import zmq
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 from IPython.core.profiledir import ProfileDir
MinRK
use BaseIPythonApp.load_config, not Application.load_config
r3991 from IPython.utils.traitlets import Bool, Dict, Unicode
MinRK
re-enable log forwarding and iplogger
r3989
MinRK
rename clusterdir to more descriptive baseapp...
r3993 from IPython.parallel.apps.baseapp import (
MinRK
update parallel apps to use ProfileDir
r3992 BaseParallelApplication,
MinRK
Show invalid config message on TraitErrors during initialization...
r5172 base_aliases,
MinRK
catch_config -> catch_config_error
r5214 catch_config_error,
MinRK
Refactor newparallel to use Config system...
r3604 )
MinRK
fix residual import issues with IPython.parallel reorganization
r3688 from IPython.parallel.apps.logwatcher import LogWatcher
MinRK
Refactor newparallel to use Config system...
r3604
#-----------------------------------------------------------------------------
# Module level variables
#-----------------------------------------------------------------------------
#: The default config file name for this application
MinRK
parallel docs, tests, default config updated to newconfig
r3990 _description = """Start an IPython logger for parallel computing.
MinRK
Refactor newparallel to use Config system...
r3604
IPython controllers and engines (and your own processes) can broadcast log messages
by registering a `zmq.log.handlers.PUBHandler` with the `logging` module. The
logger can be configured using command line options or using a cluster
directory. Cluster directories contain config, log and security files and are
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 usually located in your ipython directory and named as "profile_name".
Brian E. Granger
Finishing up help string work.
r4218 See the `profile` and `profile-dir` options for details.
MinRK
Refactor newparallel to use Config system...
r3604 """
#-----------------------------------------------------------------------------
# Main application
#-----------------------------------------------------------------------------
MinRK
re-enable log forwarding and iplogger
r3989 aliases = {}
aliases.update(base_aliases)
aliases.update(dict(url='LogWatcher.url', topics='LogWatcher.topics'))
MinRK
Refactor newparallel to use Config system...
r3604
MinRK
update parallel apps to use ProfileDir
r3992 class IPLoggerApp(BaseParallelApplication):
MinRK
Refactor newparallel to use Config system...
r3604
MinRK
default config files are automatically generated...
r4025 name = u'iplogger'
MinRK
Refactor newparallel to use Config system...
r3604 description = _description
MinRK
update parallel apps to use ProfileDir
r3992 classes = [LogWatcher, ProfileDir]
MinRK
re-enable log forwarding and iplogger
r3989 aliases = Dict(aliases)
MinRK
catch_config -> catch_config_error
r5214 @catch_config_error
MinRK
re-enable log forwarding and iplogger
r3989 def initialize(self, argv=None):
super(IPLoggerApp, self).initialize(argv)
self.init_watcher()
def init_watcher(self):
MinRK
Refactor newparallel to use Config system...
r3604 try:
MinRK
use `parent=self` throughout IPython...
r11064 self.watcher = LogWatcher(parent=self, log=self.log)
MinRK
Refactor newparallel to use Config system...
r3604 except:
self.log.error("Couldn't start the LogWatcher", exc_info=True)
self.exit(1)
MinRK
re-enable log forwarding and iplogger
r3989 self.log.info("Listening for log messages on %r"%self.watcher.url)
MinRK
Refactor newparallel to use Config system...
r3604
MinRK
re-enable log forwarding and iplogger
r3989 def start(self):
self.watcher.start()
MinRK
Refactor newparallel to use Config system...
r3604 try:
self.watcher.loop.start()
except KeyboardInterrupt:
self.log.critical("Logging Interrupted, shutting down...\n")
MinRK
Application.launch_instance...
r11176 launch_new_instance = IPLoggerApp.launch_instance
MinRK
Refactor newparallel to use Config system...
r3604
if __name__ == '__main__':
launch_new_instance()