本文整理汇总了Python中flexget.ipc.IPCClient.execute方法的典型用法代码示例。如果您正苦于以下问题:Python IPCClient.execute方法的具体用法?Python IPCClient.execute怎么用?Python IPCClient.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexget.ipc.IPCClient
的用法示例。
在下文中一共展示了IPCClient.execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_command
# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import execute [as 别名]
def execute_command(self, options):
"""
Send execute command to daemon through IPC or perform execution
on current process.
Fires events:
* manager.execute.completed
:param options: argparse options
"""
# If a daemon is started, send the execution to the daemon
ipc_info = self.check_ipc_info()
if ipc_info:
client = IPCClient(ipc_info['port'], ipc_info['password'])
client.execute(dict(options))
self.shutdown()
return
# Otherwise we run the execution ourselves
with self.acquire_lock():
fire_event('manager.execute.started', self)
self.scheduler.start(run_schedules=False)
self.scheduler.execute(options)
self.scheduler.shutdown(finish_queue=True)
try:
self.scheduler.wait()
except KeyboardInterrupt:
log.error('Got ctrl-c exiting after this task completes. Press ctrl-c again to abort this task.')
else:
fire_event('manager.execute.completed', self)
self.shutdown(finish_queue=False)
示例2: execute_command
# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import execute [as 别名]
def execute_command(self, options):
"""
Send execute command to daemon through IPC or perform execution
on current process.
Fires events:
* manager.execute.completed
:param options: argparse options
"""
# If a daemon is started, send the execution to the daemon
ipc_info = self.check_ipc_info()
if ipc_info:
try:
log.info('There is a daemon running for this config. Sending execution to running daemon.')
client = IPCClient(ipc_info['port'], ipc_info['password'])
except ValueError as e:
log.error(e)
else:
client.execute(dict(options, loglevel=self.options.loglevel))
self.shutdown()
return
# Otherwise we run the execution ourselves
with self.acquire_lock():
fire_event('manager.execute.started', self)
self.task_queue.start()
self.execute(options)
self.shutdown(finish_queue=True)
self.task_queue.wait()
fire_event('manager.execute.completed', self)