def processEnded(self, reason): if reason.value == error.ProcessDone: log.info('Process %s terminated normally.'%self.process_name) else: log.warn('Process %s terminated with exit code %s.'%(self.process_name, reason.value.exitCode)) for protocol in self.stdout_protocol, self.stderr_protocol, self.stdin_protocol: protocol.processEnded(reason) if self.restart: reactor.callLater(self.restart_wait, self.spawn_process)
def configure(self, runtime_environment): routing = self.site_configuration["routing"] if self.debug_configuration: log.debug('Debugging enabled for site "%s": %s.' % (self.site_name, self.debug_configuration)) if not self.debug_configuration["allow"]: log.warn('No clients are currently allowed to debug on site "%s".' % self.site_name) root_resource = WebResource(self, routing) root_resource.configure(runtime_environment) self.factory = server.Site(root_resource) self.factory.displayTracebacks = bool(self.debug_configuration) self.tcpserver = internet.TCPServer(self.site_configuration.get("port", 8080), self.factory) self.tcpserver.setServiceParent(self)
def process(self, baton): status_text = util.dict_get_path(baton, self.status_path, Ellipsis) if status_text is not Ellipsis: # get the api by waiting for the dependency to become ready api = yield self.api_dependency.wait_for_resource() try: status = yield api.update_status(status_text) except error.TweepError as e: log.error('Error updating the status: %s' % e) else: log.warn('Updated the status of %r to %r' % (status.user.screen_name, status.text)) else: log.warn('No value at %r in the baton. Not updating the status.' % self.status_path) # return the baton unchanged defer.returnValue(baton)