Exemplo n.º 1
0
def test_extra_resources(HelloTest, testsys_system):
    @fixtures.custom_prefix('unittests/resources/checks')
    class MyTest(HelloTest):
        def __init__(self):
            super().__init__()
            self.name = type(self).__name__
            self.executable = os.path.join('.', self.name)
            self.local = True

        @rfm.run_after('setup')
        def set_resources(self):
            test.extra_resources = {
                'gpu': {
                    'num_gpus_per_node': 2
                },
                'datawarp': {
                    'capacity': '100GB',
                    'stagein_src': test.stagedir
                }
            }
            test.job.options += ['--foo']

    test = MyTest()
    partition = fixtures.partition_by_name('gpu')
    environ = partition.environment('builtin')
    _run(test, partition, environ)
    expected_job_options = {
        '--gres=gpu:2', '#DW jobdw capacity=100GB',
        f'#DW stage_in source={test.stagedir}', '--foo'
    }
    assert expected_job_options == set(test.job.options)
Exemplo n.º 2
0
def local_exec_ctx(generic_system):
    partition = fixtures.partition_by_name('default')
    environ = fixtures.environment_by_name('builtin', partition)
    yield partition, environ
Exemplo n.º 3
0
def test_partition(sample_checks):
    p = fixtures.partition_by_name('gpu')
    assert 2 == count_checks(filters.have_partition([p]), sample_checks)
    p = fixtures.partition_by_name('login')
    assert 0 == count_checks(filters.have_partition([p]), sample_checks)
Exemplo n.º 4
0
def dummy_gpu_exec_ctx(testsys_system):
    partition = fixtures.partition_by_name('gpu')
    environ = fixtures.environment_by_name('builtin', partition)
    yield partition, environ
Exemplo n.º 5
0
 def test_partition(self):
     p = fixtures.partition_by_name('gpu')
     assert 2 == self.count_checks(filters.have_partition([p]))
     p = fixtures.partition_by_name('login')
     assert 0 == self.count_checks(filters.have_partition([p]))