本文整理汇总了Python中twisted.application.service.Service.stopService方法的典型用法代码示例。如果您正苦于以下问题:Python Service.stopService方法的具体用法?Python Service.stopService怎么用?Python Service.stopService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.application.service.Service
的用法示例。
在下文中一共展示了Service.stopService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
"""
Stop the service by calling stored function
"""
Service.stopService(self)
if self._stop:
return self._stop()
示例2: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
"""
Stop service by stopping the timerservice and disconnecting cass client
"""
Service.stopService(self)
d = self._service.stopService()
return d.addCallback(lambda _: self._client.disconnect())
示例3: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
if self.running:
Service.stopService(self)
log.info("Stopping master heartbeat service...")
return self._hb.stop()
else:
return defer.succeed(None)
示例4: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
Service.stopService(self)
try:
self.app.close()
except Exception:
logger.error('Error while closing application', exc_info=True)
self._close_database()
示例5: 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)
示例6: s2
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def s2(code, self=self):
try:
if code != 1:
# Cancel stop
return
if not (self._state == 'stopping' and (self._process + self._workers) == 0):
err(RuntimeError('{0} stop error: state-{1} p{2} w{3}'.format(
self.name,
self._state,
self._process,
self._workers,
)))
self._stopCall = None
self._stopDeferred = None
# Inside
Service.stopService(self)
self._state = 'stopped'
# Show info
msg(self.name, 'stopped', system='-')
except:
err()
示例7: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
print 'Stop PullRequest service: %s ...' % self.context.name
Service.stopService(self)
if self.watchLoop:
self.watchLoop.stop()
if self.schedulerLoop:
self.schedulerLoop.stop()
示例8: main
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def main(self):
"""Parse arguments and run the script's main function via ``react``."""
# If e.g. --version is called this may throw a SystemExit, so we
# always do this first before any side-effecty code is run:
options = self._parse_options(self.sys_module.argv[1:])
if self.logging:
log_writer = eliot_logging_service(
options.eliot_destination, self._reactor, True
)
else:
log_writer = Service()
log_writer.startService()
# XXX: We shouldn't be using this private _reactor API. See
# https://twistedmatrix.com/trac/ticket/6200 and
# https://twistedmatrix.com/trac/ticket/7527
def run_and_log(reactor):
d = maybeDeferred(self.script.main, reactor, options)
def got_error(failure):
if not failure.check(SystemExit):
err(failure)
return failure
d.addErrback(got_error)
return d
try:
self._react(run_and_log, [], _reactor=self._reactor)
finally:
log_writer.stopService()
示例9: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
ntasks = len(self._tasks)
for task in self.iterTasks():
task.close()
self._tasks = set()
Service.stopService(self)
logger.debug("stopped scheduler (%i tasks killed)" % ntasks)
示例10: 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 self._loop and self._loop.running is True:
self._loop.stop()
self._loop = None
Service.stopService(self)
示例11: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
Service.stopService(self)
if self.__ws_port_obj is None:
raise Exception('Not started, cannot stop')
# TODO: Does Twisted already have something to bundle up a bunch of ports for shutdown?
return defer.DeferredList([
self.__http_port_obj.stopListening(),
self.__ws_port_obj.stopListening()])
示例12: 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()
示例13: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self, stopReactor=False):
Service.stopService(self)
if self.pipeline is not None:
self.forceEos()
else:
self.shutdown(EXIT_OK, stopReactor)
return self.shutdownDeferred
示例14: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
"Stop reading from the stream."
ret = None
if self._streamDone is not None:
self._streamDone.cancel()
ret = self._streamDone
self._streamDone = None
Service.stopService(self)
return ret
示例15: stopService
# 需要导入模块: from twisted.application.service import Service [as 别名]
# 或者: from twisted.application.service.Service import stopService [as 别名]
def stopService(self):
"""Stop All Janitizer Service"""
try:
if self.GARBAGE_CHECK.running:
self.GARBAGE_CHECK.stop()
if self.ELDERLY_CHECK.running:
self.ELDERLY_CHECK.stop()
except: pass
Service.stopService(self)