def __init__(self, master_nodes, name, read_only=False, compress=None, logfile=None, _app=None, **kw): """ Do not pass those parameters (used internally): _app """ if compress is None: compress = True if logfile: logging.setup(logfile) BaseStorage.BaseStorage.__init__(self, 'NEOStorage(%s)' % (name, )) # Warning: _is_read_only is used in BaseStorage, do not rename it. self._is_read_only = read_only if read_only: for method_id in ( 'new_oid', 'tpc_begin', 'tpc_vote', 'tpc_abort', 'store', 'deleteObject', 'undo', 'undoLog', ): setattr(self, method_id, raiseReadOnlyError) if _app is None: ssl = [kw.pop(x, None) for x in ('ca', 'cert', 'key')] _app = Application(master_nodes, name, compress=compress, ssl=ssl if any(ssl) else None, **kw) self.app = _app
def start(self, with_uuid=True): # Prevent starting when already forked and wait wasn't called. if self.pid != 0: raise AlreadyRunning, 'Already running with PID %r' % (self.pid, ) command = self.command args = [] self.with_uuid = with_uuid for arg, param in self.arg_dict.iteritems(): if with_uuid is False and arg == '--uuid': continue args.append(arg) if param is not None: args.append(str(param)) self.pid = os.fork() if self.pid == 0: # Child try: # release SQLite debug log logging.setup() sys.argv = [command] + args getattr(neo.scripts, command).main() status = 0 except SystemExit, e: status = e.code if status is None: status = 0 except KeyboardInterrupt: status = 1
def setupLog(self): test_id = self.id() i = self.__run_count.get(test_id, 0) self.__run_count[test_id] = 1 + i if i: test_id += '-%s' % i logging.setup(os.path.join(getTempDirectory(), test_id + '.log')) return LoggerThreadName()
def main(args=None): from neo.master.app import Application config = Application.option_parser.parse(args) # setup custom logging logging.setup(config.get('logfile')) # and then, load and run the application app = Application(config) app.run()
def main(args=None): # build configuration dict from command line options (options, args) = parser.parse_args(args=args) config = ConfigurationManager(defaults, options, 'master') # setup custom logging logging.setup(config.getLogfile()) # and then, load and run the application from neo.master.app import Application app = Application(config) app.run()
def main(args=None): # TODO: Forbid using "reset" along with any unneeded argument. # "reset" is too dangerous to let user a chance of accidentally # letting it slip through in a long option list. # We should drop support configation files to make such check useful. (options, args) = parser.parse_args(args=args) config = ConfigurationManager(defaults, options, 'storage') # setup custom logging logging.setup(config.getLogfile()) # and then, load and run the application from neo.storage.app import Application app = Application(config) if not config.getReset(): app.run()
def main(args=None): from neo.neoctl.neoctl import NeoCTL config = NeoCTL.option_parser.parse(args) logfile = config.get('logfile') if logfile: # Contrary to daemons, we log everything to disk automatically # because a user using -l option here: # - is certainly debugging an issue and wants everything, # - would not have to time to send SIGRTMIN before neoctl exits. logging.backlog(None) logging.setup(logfile) from neo.neoctl.app import Application app = Application(config['address'], ssl=config.get('ssl')) r = app.execute(config['cmd']) if r is not None: print r
def main(args=None): (options, args) = parser.parse_args(args=args) if options.address is not None: address = parseNodeAddress(options.address, 9999) else: address = ('127.0.0.1', 9999) if options.logfile: # Contrary to daemons, we log everything to disk automatically # because a user using -l option here: # - is certainly debugging an issue and wants everything, # - would not have to time to send SIGRTMIN before neoctl exits. logging.backlog(None) logging.setup(options.logfile) from neo.neoctl.app import Application ssl = options.ca, options.cert, options.key r = Application(address, ssl=ssl if any(ssl) else None).execute(args) if r is not None: print r
def setupLog(self): test_case, logging.name = self.id().rsplit('.', 1) logging.setup(os.path.join(getTempDirectory(), test_case + '.log'))
def setupLog(self): logging.setup(os.path.join(self.getTempDirectory(), 'test.log'))
def setupLog(self): log_file = os.path.join(getTempDirectory(), self.id() + '.log') logging.setup(log_file) return LoggerThreadName()