當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。