当前位置: 首页>>代码示例>>Python>>正文


Python Service.stopService方法代码示例

本文整理汇总了Python中twisted.application.service.Service.stopService方法的典型用法代码示例。如果您正苦于以下问题:Python Service.stopService方法的具体用法?Python Service.stopService怎么用?Python Service.stopService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.application.service.Service的用法示例。


在下文中一共展示了Service.stopService方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _sync_soledad

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def _sync_soledad(self):
        """
        Synchronize with remote soledad.

        :returns: a list of LeapDocuments, or None.
        :rtype: iterable or None
        """
        def _log_synced(result):
            self.log.info('Sync finished')
            return result

        def _handle_invalid_auth_token_error(failure):
            failure.trap(InvalidAuthTokenError)
            self.log.warn('Sync failed because token is invalid: %r' % failure)
            self.stopService()
            emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN, self._userid)

        self.log.info('Starting sync...')
        d = self._soledad.sync()
        d.addCallbacks(_log_synced, _handle_invalid_auth_token_error)
        return d 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:23,代码来源:service.py

示例2: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        """
        Stops the loop that fetches mail.
        """
        if not self.running:
            return

        if self._loop and self._loop.running is True:
            self._loop.stop()
            self._loop = None
        Service.stopService(self) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:13,代码来源:service.py

示例3: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        Service.stopService(self)
        return self.stop_result 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:5,代码来源:test_script.py

示例4: test_wait_for_service_stop

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def test_wait_for_service_stop(self):
        """
        The ``Deferred`` returned by ``main_for_service`` does not fire before
        the ``Deferred`` returned by the service's ``stopService`` method
        fires.
        """
        result = main_for_service(self.reactor, AsyncStopService(Deferred()))
        self._shutdown_reactor(self.reactor)
        self.assertNoResult(result) 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:11,代码来源:test_script.py

示例5: test_fire_after_service_stop

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def test_fire_after_service_stop(self):
        """
        The ``Deferred`` returned by ``main_for_service`` fires once the
        ``Deferred`` returned by the service's ``stopService`` method fires.
        """
        async = Deferred()
        result = main_for_service(self.reactor, AsyncStopService(async))
        self._shutdown_reactor(self.reactor)
        async.callback(None)
        self.assertIs(None, self.successResultOf(result)) 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:12,代码来源:test_script.py

示例6: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        Service.stopService(self)
        self.ready = False
        self._registered = False
        for d in list(self._waiting):
            d.cancel()
        self._waiting = []
        return self._timer_service.stopService() 
开发者ID:twisted,项目名称:txacme,代码行数:10,代码来源:service.py

示例7: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        if self.metric_interval > 0:
            self.record_task.stop()
        Service.stopService(self)


# avoid import circularities 
开发者ID:douban,项目名称:Kenshin,代码行数:9,代码来源:instrumentation.py

示例8: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        try:
            file_cache_idxs = MetricCache.getAllFileCaches()
            writeCachedDataPointsWhenStop(file_cache_idxs)
        except Exception as e:
            log.err('write error when stopping service: %s' % e)
        Service.stopService(self) 
开发者ID:douban,项目名称:Kenshin,代码行数:9,代码来源:writer.py

示例9: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        """
        Stop the writer thread, wait for it to finish.
        """
        Service.stopService(self)
        removeDestination(self)
        self._reactor.callFromThread(self._reactor.stop)
        return deferToThreadPool(
            self._mainReactor, self._mainReactor.getThreadPool(), self._thread.join
        ) 
开发者ID:itamarst,项目名称:eliot,代码行数:12,代码来源:logwriter.py

示例10: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        """
        Stop reading on the inherited port.

        @return: a Deferred which fires after the last outstanding request is
            complete.
        """
        Service.stopService(self)
        # XXX stopping should really be destructive, because otherwise we will
        # always leak a file descriptor; i.e. this shouldn't be restartable.
        self.reportingFactory.inheritedPort.stopReading()

        # Let any outstanding requests finish
        return self.reportingFactory.allConnectionsClosed() 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:16,代码来源:metafd.py

示例11: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        info("Stopping client...")
        Service.stopService(self)

        # If CTRL-C is pressed twice in a row, the second SIGINT actually
        # kills us before subprocesses die, and that makes them hang around.
        signal.signal(signal.SIGINT, signal.SIG_IGN)

        done = self.watchdog.request_exit()
        done.addBoth(lambda r: self._remove_pid())
        return done 
开发者ID:CanonicalLtd,项目名称:landscape-client,代码行数:13,代码来源:watchdog.py

示例12: stopService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
        # We don't need to call port.stopListening(), because the reactor
        # shutdown sequence will do that for us.
        Service.stopService(self)
        logging.info("%s stopped with config %s" % (
            self.service_name.capitalize(), self.config.get_config_filename())) 
开发者ID:CanonicalLtd,项目名称:landscape-client,代码行数:8,代码来源:service.py

示例13: startService

# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def startService(self):
        Service.startService(self)
        bootstrap_list.bootstrap(data_path=self._config.data_path,
                                 log_dir=self._config.log_dir)
        if self._config.clones > 0:

            # Let clones open an appropriate number of fds
            setrlimit(RLIMIT_NOFILE, (self._config.clones * 100,
                                      self._config.clones * 200))

            # Increase the timeout of AMP's MethodCalls.
            # XXX: we should find a better way to expose this knot, and
            # not set it globally on the class
            from landscape.lib.amp import MethodCallSender
            MethodCallSender.timeout = 300

            # Create clones log and data directories
            for i in range(self._config.clones):
                suffix = "-clone-%d" % i
                bootstrap_list.bootstrap(
                    data_path=self._config.data_path + suffix,
                    log_dir=self._config.log_dir + suffix)

        result = succeed(None)
        result.addCallback(lambda _: self.watchdog.check_running())

        def start_if_not_running(running_daemons):
            if running_daemons:
                error("ERROR: The following daemons are already running: %s"
                      % (", ".join(x.program for x in running_daemons)))
                self.exit_code = 1
                reactor.crash()  # so stopService isn't called.
                return
            self._daemonize()
            info("Watchdog watching for daemons.")
            return self.watchdog.start()

        def die(failure):
            log_failure(failure, "Unknown error occurred!")
            self.exit_code = 2
            reactor.crash()
        result.addCallback(start_if_not_running)
        result.addErrback(die)
        return result 
开发者ID:CanonicalLtd,项目名称:landscape-client,代码行数:46,代码来源:watchdog.py


注:本文中的twisted.application.service.Service.stopService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。