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


Python Application.application_name方法代码示例

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


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

示例1: test_flavor_selection_application_specific_unavailable

# 需要导入模块: from gc3libs import Application [as 别名]
# 或者: from gc3libs.Application import application_name [as 别名]
    def test_flavor_selection_application_specific_unavailable(self):
        """
        Test that application-specific "instance type" is ignored if unavailable.
        """
        # NOTE: `EXTRA_CONF` has to start with a blank line and with the first
        # non-whitespace character in column 0, otherwise `ConfigParser` will
        # consider it a continuation of the last key/value assignment in
        # `RESOURCE_STANZA` ...
        EXTRA_CONF = """

large_instance_type = 5cpu-11ram-server
"""
        cloud, flavors = self._setup_flavor_selection_tests(EXTRA_CONF)

        # no instance type specified, should get smallest one
        app1 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
        )
        flv = cloud.get_instance_type_for_job(app1)
        assert flv == flavors[0]

        # application-specific instance type specified but unavailable:
        # should yield same result as before
        app2 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
        )
        app2.application_name = 'large'
        flv = cloud.get_instance_type_for_job(app2)
        assert flv == flavors[0]

        # application-specific instance type specified,
        # but requirements exclude it
        app3 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
            requested_cores=6,
        )
        app3.application_name = 'large'
        flv = cloud.get_instance_type_for_job(app3)
        assert flv == flavors[2]
开发者ID:fliem,项目名称:gc3pie,代码行数:50,代码来源:test_openstack.py

示例2: test_flavor_selection_generic_instance_type

# 需要导入模块: from gc3libs import Application [as 别名]
# 或者: from gc3libs.Application import application_name [as 别名]
    def test_flavor_selection_generic_instance_type(self):
        """
        Test flavor selection when a default flavor is prescribed by config.
        """
        # NOTE: `EXTRA_CONF` has to start with a blank line and with the first
        # non-whitespace character in column 0, otherwise `ConfigParser` will
        # consider it a continuation of the last key/value assignment in
        # `RESOURCE_STANZA` ...
        EXTRA_CONF = """

instance_type = 4cpu-16ram-hpc
small_instance_type = 1cpu-4ram-hpc
"""
        cloud, flavors = self._setup_flavor_selection_tests(EXTRA_CONF)

        # no instance type specified, should get configured one
        app1 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
        )
        flv = cloud.get_instance_type_for_job(app1)
        assert flv == flavors[1]

        # application-specific instance type specified, should override default
        app2 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
        )
        app2.application_name = 'small'
        flv = cloud.get_instance_type_for_job(app2)
        assert flv == flavors[0]

        # requirements exclude default instance type
        app3 = Application(
            ['/bin/true'],
            inputs=[],
            outputs=[],
            output_dir='/tmp',
            requested_cores=6,
        )
        app3.application_name = 'large'
        flv = cloud.get_instance_type_for_job(app3)
        assert flv == flavors[2]
开发者ID:fliem,项目名称:gc3pie,代码行数:49,代码来源:test_openstack.py

示例3: test_pbs_prologue_and_epilogue_contents_when_not_files

# 需要导入模块: from gc3libs import Application [as 别名]
# 或者: from gc3libs.Application import application_name [as 别名]
    def test_pbs_prologue_and_epilogue_contents_when_not_files(self):
        """Prologue and epilogue scripts are inserted in the submission script
        """
        # Ugly hack. We have to list the job dirs to check which one
        # is the new one.
        jobdir = os.path.expanduser('~/.gc3pie_jobs')
        jobs = []
        if os.path.isdir(jobdir):
            jobs = os.listdir(jobdir)
        app = Application(['/bin/true'], [], [], '')
        app.application_name = 'app2'
        self.core = gc3libs.core.Core(self.cfg)
        self.core.select_resource('testpbs')
        try:
            self.core.submit(app)
        except Exception:
            # it is normal to have an error since we don't probably
            # run a pbs server in this machine.
            pass

        newjobs = [d for d in os.listdir(jobdir) if d not in jobs]

        # There must be only one more job...
        assert_equal(len(newjobs), 1)

        newjobdir = os.path.join(jobdir, newjobs[0])
        self.files_to_remove.append(newjobdir)

        # and only one file in it
        assert_equal(len(os.listdir(newjobdir)), 1)

        # Check the content of the script file
        scriptfname = os.path.join(newjobdir, (os.listdir(newjobdir)[0]))
        scriptfile = open(scriptfname)
        assert re.match(
            "#!/bin/sh.*"
            "# prologue file `.*` BEGIN.*"
            "echo prologue.*"
            "# prologue file END.*"
            "# inline script BEGIN.*"
            "echo prologue app2.*"
            "# inline script END.*"
            "/bin/true.*"
            "# epilogue file `.*` BEGIN.*"
            "echo epilogue.*"
            "# epilogue file END.*"
            "# inline script BEGIN.*"
            "echo epilogue app2.*"
            "# inline script END",
            scriptfile.read(),
            re.DOTALL | re.M)
        scriptfile.close()

        # kill the job
        if app.execution.state != Run.State.NEW:
            self.core.kill(app)
开发者ID:arcimboldo,项目名称:gc3pie,代码行数:58,代码来源:test_config.py


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