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


Python IPCClient.handle_cli方法代码示例

本文整理汇总了Python中flexget.ipc.IPCClient.handle_cli方法的典型用法代码示例。如果您正苦于以下问题:Python IPCClient.handle_cli方法的具体用法?Python IPCClient.handle_cli怎么用?Python IPCClient.handle_cli使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flexget.ipc.IPCClient的用法示例。


在下文中一共展示了IPCClient.handle_cli方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start

# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import handle_cli [as 别名]
    def start(self):
        """
        Starting point when executing from commandline, dispatch execution to correct destination.

        If there is a FlexGet process with an ipc server already running, the command will be sent there for execution
        and results will be streamed back.
        If not, this will attempt to obtain a lock, initialize the manager, and run the command here.
        """
        # If another process is started, send the execution to the running process
        ipc_info = self.check_ipc_info()
        if ipc_info:
            try:
                log.info('There is a FlexGet process already running for this config, sending execution there.')
                client = IPCClient(ipc_info['port'], ipc_info['password'])
            except ValueError as e:
                log.error(e)
            else:
                try:
                    client.handle_cli(self.args)
                except KeyboardInterrupt:
                    log.error('Disconnecting from daemon due to ctrl-c. Executions will still continue in the '
                              'background.')
                except EOFError:
                    log.error('Connection from daemon was severed.')
            return
        # No running process, we start our own to handle command
        with self.acquire_lock():
            self.initialize()
            self.handle_cli()
            self._shutdown()
开发者ID:H1ghT0p,项目名称:Flexget,代码行数:32,代码来源:manager.py

示例2: start

# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import handle_cli [as 别名]
    def start(self):
        """
        Starting point when executing from commandline, dispatch execution to correct destination.

        If there is a FlexGet process with an ipc server already running, the command will be sent there for execution
        and results will be streamed back.
        If not, this will attempt to obtain a lock, initialize the manager, and run the command here.
        """
        if sys.version_info <= (2, 7):
            console('-' * 79)
            console('Python 2.7 will not be maintained past 2020 !')
            console('Consider upgrading to 3.6 or newer at your earliest convenience.')
            console('-' * 79)
        # When we are in test mode, we use a different lock file and db
        if self.options.test:
            self.lockfile = os.path.join(self.config_base, '.test-%s-lock' % self.config_name)
        # If another process is started, send the execution to the running process
        ipc_info = self.check_ipc_info()
        if ipc_info:
            console(
                'There is a FlexGet process already running for this config, sending execution there.'
            )
            log.debug('Sending command to running FlexGet process: %s' % self.args)
            try:
                client = IPCClient(ipc_info['port'], ipc_info['password'])
            except ValueError as e:
                log.error(e)
            else:
                try:
                    client.handle_cli(self.args)
                except KeyboardInterrupt:
                    log.error(
                        'Disconnecting from daemon due to ctrl-c. Executions will still continue in the '
                        'background.'
                    )
                except EOFError:
                    log.error('Connection from daemon was severed.')
            return
        if self.options.test:
            log.info('Test mode, creating a copy from database ...')
            db_test_filename = os.path.join(self.config_base, 'test-%s.sqlite' % self.config_name)
            if os.path.exists(self.db_filename):
                shutil.copy(self.db_filename, db_test_filename)
                log.info('Test database created')
            self.db_filename = db_test_filename
        # No running process, we start our own to handle command
        with self.acquire_lock():
            self.initialize()
            self.handle_cli()
            self._shutdown()
开发者ID:Flexget,项目名称:Flexget,代码行数:52,代码来源:manager.py

示例3: start

# 需要导入模块: from flexget.ipc import IPCClient [as 别名]
# 或者: from flexget.ipc.IPCClient import handle_cli [as 别名]
    def start(self):
        """
        Starting point when executing from commandline, dispatch execution to correct destination.

        If there is a FlexGet process with an ipc server already running, the command will be sent there for execution
        and results will be streamed back.
        If not, this will attempt to obtain a lock, initialize the manager, and run the command here.
        """
        # When we are in test mode, we use a different lock file and db
        if self.options.test:
            self.lockfile = os.path.join(self.config_base, ".test-%s-lock" % self.config_name)
        # If another process is started, send the execution to the running process
        ipc_info = self.check_ipc_info()
        if ipc_info:
            console("There is a FlexGet process already running for this config, sending execution there.")
            log.debug("Sending command to running FlexGet process: %s" % self.args)
            try:
                client = IPCClient(ipc_info["port"], ipc_info["password"])
            except ValueError as e:
                log.error(e)
            else:
                try:
                    client.handle_cli(self.args)
                except KeyboardInterrupt:
                    log.error(
                        "Disconnecting from daemon due to ctrl-c. Executions will still continue in the " "background."
                    )
                except EOFError:
                    log.error("Connection from daemon was severed.")
            return
        if self.options.test:
            log.info("Test mode, creating a copy from database ...")
            db_test_filename = os.path.join(self.config_base, "test-%s.sqlite" % self.config_name)
            if os.path.exists(self.db_filename):
                shutil.copy(self.db_filename, db_test_filename)
                log.info("Test database created")
            self.db_filename = db_test_filename
        # No running process, we start our own to handle command
        with self.acquire_lock():
            self.initialize()
            self.handle_cli()
            self._shutdown()
开发者ID:jmcabrera,项目名称:Flexget,代码行数:44,代码来源:manager.py


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