def out_backend(): """ Simple backend for pretty-printing events received from Controller. """ config.backend_conf(defaults={'NAME': 'beah_out_backend'}, overrides=config.backend_opts()) log_handler() start_backend(PprintBackend())
def out_backend(): """ Simple backend for pretty-printing events received from Controller. """ config.backend_conf( defaults={'NAME':'beah_out_backend'}, overrides=config.backend_opts()) log_handler() start_backend(PprintBackend())
def start_forwarder_backend(): if parse_bool(config.get_conf('beah-backend').get('DEFAULT', 'DEVEL')): print_this = log_this(lambda s: log.debug(s), log_on=True) make_class_verbose(ForwarderBackend, print_this) make_class_verbose(_RemoteBackend, print_this) backend = ForwarderBackend() # Start a default TCP client: start_backend(backend) return backend
def remote_backend(self, dest): dest_s = '%s:%s' % dest rb = self.__remotes.get(dest_s, None) if rb is None: rb = _RemoteBackend(self, dest) start_backend(rb, host=dest[0], port=dest[1], byef=lambda evt: None) self.__remotes[dest_s] = rb return rb
def cmd_backend(): """ Interactive backend issuing commands to Controller. I do not want to stop reactor directly, but would like if it stopped if there are no more protocols. """ backend = TwistedCmdBackend() # Start a LineReceiver on stdio: stdio.StandardIO(backend) # Start a default TCP client: start_backend(backend.backend)
def start_watchdog_backend(conf): '''Starts a watchdog backend with specified configuration.''' log = logging.getLogger('backend') if parse_bool(conf.get('DEFAULT', 'DEVEL')): print_this = log_this(log.debug, log_on=True) make_class_verbose(WatchdogBackend, print_this) make_class_verbose(Task, print_this) handlers = dict(DEFAULT_HANDLERS) load_plugins(WATCHDOG_ENTRYPOINT, handlers) backend = WatchdogBackend(conf=conf, log=log, handlers=handlers) query_interval = int(conf.get('DEFAULT', 'QUERY_WATCHDOG')) if query_interval > 0: watchdogs_request = LoopingCall(backend.query_watchdogs) watchdogs_request.start(query_interval, now=False) #pylint: disable=E1101 reactor.addSystemEventTrigger('before', 'shutdown', watchdogs_request.stop) # Start a default TCP client: backend.initialize() start_backend(backend)
def beah_run(coro, **kwargs): """ This is a Backend to issue script to Controller. Type help on the prompt for help o commands. You might not see any output here - run out_backend. Known issues: * Type <Ctrl-C> to finish. I do not want to stop reactor directly, but would like if it stopped when there are no more protocols. """ config.backend_conf( defaults={'NAME':'beahcmd_backend'}, overrides=config.backend_opts()) log_handler() backend = BeahRunner(coro) # Start a default TCP client: start_backend(backend, **kwargs)
def main_beah(args=None): """\ This is a Backend to issue commands to Controller. Type help on the prompt for help o commands. You might not see any output here - run out_backend. Known issues: * Type <Ctrl-C> to finish. I do not want to stop reactor directly, but would like if it stopped if there are no more protocols. """ overrides, rest = config.backend_opts_ex(args=args) config.backend_conf(defaults={'NAME': 'beah_cli_backend'}, overrides=overrides) log_handler() cmdline = ' '.join(["%r" % r for r in rest]) backend = CmdLineBackend(cmdline) # Start a default TCP client: start_backend(backend)
def main_beah(args=None): """\ This is a Backend to issue commands to Controller. Type help on the prompt for help o commands. You might not see any output here - run out_backend. Known issues: * Type <Ctrl-C> to finish. I do not want to stop reactor directly, but would like if it stopped if there are no more protocols. """ overrides, rest = config.backend_opts_ex(args=args) config.backend_conf( defaults={'NAME':'beah_cli_backend'}, overrides=overrides) log_handler() cmdline = ' '.join(["%r" % r for r in rest]) backend = CmdLineBackend(cmdline) # Start a default TCP client: start_backend(backend)