本文整理汇总了Python中flexget.ipc.IPCClient.reload方法的典型用法代码示例。如果您正苦于以下问题:Python IPCClient.reload方法的具体用法?Python IPCClient.reload怎么用?Python IPCClient.reload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexget.ipc.IPCClient
的用法示例。
在下文中一共展示了IPCClient.reload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: daemon_command
# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import reload [as 别名]
def daemon_command(self, options):
"""
Fires events:
* manager.daemon.started
* manager.daemon.completed
:param options: argparse options
"""
if options.action == 'start':
if options.daemonize:
self.daemonize()
with self.acquire_lock():
try:
signal.signal(signal.SIGTERM, self._handle_sigterm)
except ValueError as e:
# If flexget is being called from another script, e.g. windows service helper, and we are not the
# main thread, this error will occur.
log.debug('Error registering sigterm handler: %s' % e)
self.ipc_server.start()
fire_event('manager.daemon.started', self)
self.scheduler.start()
try:
self.scheduler.wait()
except KeyboardInterrupt:
log.info('Got ctrl-c, shutting down.')
fire_event('manager.daemon.completed', self)
self.shutdown(finish_queue=False)
elif options.action == 'status':
ipc_info = self.check_ipc_info()
if ipc_info:
log.info('Daemon running. (PID: %s)' % ipc_info['pid'])
else:
log.info('No daemon appears to be running for this config.')
elif options.action in ['stop', 'reload']:
ipc_info = self.check_ipc_info()
if ipc_info:
try:
client = IPCClient(ipc_info['port'], ipc_info['password'])
except ValueError as e:
log.error(e)
else:
if options.action == 'stop':
client.shutdown()
elif options.action == 'reload':
client.reload()
self.shutdown()
else:
log.error('There does not appear to be a daemon running.')
示例2: daemon_command
# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import reload [as 别名]
def daemon_command(self, options):
"""
Fires events:
* manager.daemon.started
* manager.daemon.completed
:param options: argparse options
"""
if options.action == 'start':
if options.daemonize:
self.daemonize()
with self.acquire_lock():
signal.signal(signal.SIGTERM, self._handle_sigterm)
self.ipc_server.start()
fire_event('manager.daemon.started', self)
self.scheduler.start()
try:
self.scheduler.wait()
except KeyboardInterrupt:
log.info('Got ctrl-c, shutting down.')
fire_event('manager.daemon.completed', self)
self.shutdown(finish_queue=False)
elif options.action == 'status':
ipc_info = self.check_ipc_info()
if ipc_info:
log.info('Daemon running. (PID: %s)' % ipc_info['pid'])
else:
log.info('No daemon appears to be running for this config.')
elif options.action in ['stop', 'reload']:
ipc_info = self.check_ipc_info()
if ipc_info:
try:
client = IPCClient(ipc_info['port'], ipc_info['password'])
except ValueError as e:
log.error(e)
else:
if options.action == 'stop':
client.shutdown()
elif options.action == 'reload':
client.reload()
self.shutdown()
else:
log.error('There does not appear to be a daemon running.')