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


Python IPCClient.execute方法代码示例

本文整理汇总了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)
开发者ID:parhuzamos,项目名称:Flexget,代码行数:33,代码来源:manager.py

示例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)
开发者ID:edgarberlinck,项目名称:Flexget,代码行数:33,代码来源:manager.py


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