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


Python Process.format_args方法代码示例

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


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

示例1: test_process_parameters

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_process_parameters(self):

        # all the options passed to the process should be available by the
        # command / process

        p1 = Process('1', 'make-me-a-coffee',
                '$(circus.wid) --type $(circus.env.type)',
                     shell=False, spawn=False, env={'type': 'macchiato'})

        self.assertEquals(['make-me-a-coffee', '1', '--type', 'macchiato'],
                          p1.format_args())

        p2 = Process('1', 'yeah $(CIRCUS.WID)', spawn=False)
        self.assertEquals(['yeah', '1'], p2.format_args())
开发者ID:KristianOellegaard,项目名称:circus,代码行数:16,代码来源:test_process.py

示例2: test_issue310

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_issue310(self):
        '''
        https://github.com/mozilla-services/circus/pull/310

        Allow $(circus.sockets.name) to be used in args.
        '''
        conf = get_config(_CONF['issue310'])
        watcher = Watcher.load_from_config(conf['watchers'][0])
        socket = CircusSocket.load_from_config(conf['sockets'][0])
        try:
            watcher.initialize(None, {'web': socket}, None)
            process = Process(watcher._nextwid, watcher.cmd,
                              args=watcher.args,
                              working_dir=watcher.working_dir,
                              shell=watcher.shell, uid=watcher.uid,
                              gid=watcher.gid, env=watcher.env,
                              rlimits=watcher.rlimits, spawn=False,
                              executable=watcher.executable,
                              use_fds=watcher.use_sockets,
                              watcher=watcher)

            sockets_fds = watcher._get_sockets_fds()
            formatted_args = process.format_args(sockets_fds=sockets_fds)

            fd = sockets_fds['web']
            self.assertEqual(formatted_args,
                             ['foo', '--fd', str(fd)])
        finally:
            socket.close()
开发者ID:SEJeff,项目名称:circus,代码行数:31,代码来源:test_config.py

示例3: test_issue310

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_issue310(self):
        """
        https://github.com/mozilla-services/circus/pull/310

        Allow $(circus.sockets.name) to be used in args.
        """
        conf = get_config(_CONF["issue310"])
        watcher = Watcher.load_from_config(conf["watchers"][0])
        socket = CircusSocket.load_from_config(conf["sockets"][0])
        watcher.initialize(None, {"web": socket}, None)
        process = Process(
            watcher._process_counter,
            watcher.cmd,
            args=watcher.args,
            working_dir=watcher.working_dir,
            shell=watcher.shell,
            uid=watcher.uid,
            gid=watcher.gid,
            env=watcher.env,
            rlimits=watcher.rlimits,
            spawn=False,
            executable=watcher.executable,
            use_fds=watcher.use_sockets,
            watcher=watcher,
        )

        fd = watcher._get_sockets_fds()["web"]
        formatted_args = process.format_args()

        self.assertEquals(formatted_args, ["foo", "--fd", str(fd)])
开发者ID:B-Rich,项目名称:circus,代码行数:32,代码来源:test_config.py

示例4: test_process_parameters

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_process_parameters(self):
        # all the options passed to the process should be available by the
        # command / process

        p1 = Process('1', 'make-me-a-coffee',
                     '$(circus.wid) --type $(circus.env.type)',
                     shell=False, spawn=False, env={'type': 'macchiato'},
                     use_fds=USE_FDS)

        self.assertEqual(['make-me-a-coffee', '1', '--type', 'macchiato'],
                         p1.format_args())

        p2 = Process('1', 'yeah $(CIRCUS.WID)', spawn=False, use_fds=USE_FDS)
        self.assertEqual(['yeah', '1'], p2.format_args())

        os.environ['coffee_type'] = 'american'
        p3 = Process('1', 'yeah $(circus.env.type)', shell=False, spawn=False,
                     env={'type': 'macchiato'}, use_fds=USE_FDS)
        self.assertEqual(['yeah', 'macchiato'], p3.format_args())
        os.environ.pop('coffee_type')
开发者ID:andrewsmedina,项目名称:circus,代码行数:22,代码来源:test_process.py

示例5: load

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
 def load(watcher_conf):
     watcher = Watcher.load_from_config(watcher_conf.copy())
     process = Process(watcher._nextwid, watcher.cmd,
                       args=watcher.args,
                       working_dir=watcher.working_dir,
                       shell=watcher.shell, uid=watcher.uid,
                       gid=watcher.gid, env=watcher.env,
                       rlimits=watcher.rlimits, spawn=False,
                       executable=watcher.executable,
                       use_fds=watcher.use_sockets,
                       watcher=watcher)
     return process.format_args()
开发者ID:SEJeff,项目名称:circus,代码行数:14,代码来源:test_config.py

示例6: test_process_parameters

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_process_parameters(self):
        # all the options passed to the process should be available by the
        # command / process

        p1 = Process(
            "1",
            "make-me-a-coffee",
            "$(circus.wid) --type $(circus.env.type)",
            shell=False,
            spawn=False,
            env={"type": "macchiato"},
        )

        self.assertEqual(["make-me-a-coffee", "1", "--type", "macchiato"], p1.format_args())

        p2 = Process("1", "yeah $(CIRCUS.WID)", spawn=False)
        self.assertEqual(["yeah", "1"], p2.format_args())

        os.environ["coffee_type"] = "american"
        p3 = Process("1", "yeah $(circus.env.type)", shell=False, spawn=False, env={"type": "macchiato"})
        self.assertEqual(["yeah", "macchiato"], p3.format_args())
        os.environ.pop("coffee_type")
开发者ID:jwal,项目名称:circus,代码行数:24,代码来源:test_process.py

示例7: load

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
        def load(watcher_conf):
            watcher = Watcher.load_from_config(watcher_conf.copy())

            # Make sure we don't close the sockets as we will be
            # launching the Watcher with IS_WINDOWS=True
            watcher.use_sockets = True

            process = Process(watcher._nextwid, watcher.cmd,
                              args=watcher.args,
                              working_dir=watcher.working_dir,
                              shell=watcher.shell, uid=watcher.uid,
                              gid=watcher.gid, env=watcher.env,
                              rlimits=watcher.rlimits, spawn=False,
                              executable=watcher.executable,
                              use_fds=watcher.use_sockets,
                              watcher=watcher)
            return process.format_args()
开发者ID:josegonzalez,项目名称:circus,代码行数:19,代码来源:test_config.py

示例8: test_issue310

# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import format_args [as 别名]
    def test_issue310(self):
        """
        https://github.com/mozilla-services/circus/pull/310

        Allow $(circus.sockets.name) to be used in args.
        """
        conf = get_config(_CONF["issue310"])
        watcher = Watcher.load_from_config(conf["watchers"][0])
        socket = CircusSocket.load_from_config(conf["sockets"][0])
        try:
            watcher.initialize(None, {"web": socket}, None)

            if IS_WINDOWS:
                # We can't close the sockets on Windows as we
                # are redirecting stdout
                watcher.use_sockets = True

            process = Process(
                watcher._nextwid,
                watcher.cmd,
                args=watcher.args,
                working_dir=watcher.working_dir,
                shell=watcher.shell,
                uid=watcher.uid,
                gid=watcher.gid,
                env=watcher.env,
                rlimits=watcher.rlimits,
                spawn=False,
                executable=watcher.executable,
                use_fds=watcher.use_sockets,
                watcher=watcher,
            )

            sockets_fds = watcher._get_sockets_fds()
            formatted_args = process.format_args(sockets_fds=sockets_fds)

            fd = sockets_fds["web"]
            self.assertEqual(formatted_args, ["foo", "--fd", str(fd)])
        finally:
            socket.close()
开发者ID:eikonomega,项目名称:circus,代码行数:42,代码来源:test_config.py


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