Example #1
0
def configuration(config, ignore=None, add=None):
    file_list = [
        config,
    ]
    config_yaml = parse.read_configuration_file(config)
    _config = parse.parse_yaml_configuration(config_yaml)

    for job in _config.jobs:
        files = _get_files_from_job(job)
        file_list.extend(files)

    files = _get_files_from_options(_config)
    file_list.extend(files)

    if ignore:
        for file in ignore:
            if ignore in file_list:
                file_list.remove(file)
            else:
                print(f'File: {file} is not being used by rsopt configuration')
    if add:
        for file in add:
            if file not in file_list:
                file_list.append(file)
            else:
                print(f'File: {file} already found in rsopt configuration')

    tar_name = os.path.splitext(config)[0]
    create_filename = _create_tar(tar_name, file_list)
    print(f"Created tarball: {create_filename}")
Example #2
0
    def test_job_setup(self):
        config_file = read_configuration_file(self.config_file)
        config = parse_yaml_configuration(config_file, configuration=None)

        python_job = config.jobs[0]
        setup = python_job._setup

        # Path for six_hump_camel defined relative to support for cmd test
        setup.setup['input_file'] = 'support/' + setup.setup['input_file']

        assert callable(setup.function)
Example #3
0
def startup_sequence(config):
    config_yaml = parse.read_configuration_file(config)
    _config = parse.parse_yaml_configuration(config_yaml)
    mpi_environment = mpi.get_mpi_environment()
    if not mpi_environment:
        return _config
    else:
        if _config.options.nworkers != mpi_environment['nworkers']:
            print(
                "`nworkers` in Config file does not match MPI communicator size."
            )
            print("MPI communicator size will be used to set up {} workers".
                  format(mpi_environment['nworkers']))
            _config.options.nworkers = mpi_environment['nworkers']
        for k, v in mpi_environment.items():
            if hasattr(_config, k):
                _config.__setattr__(k, v)

    return _config
Example #4
0
 def test_config_import(self):
     config_file = read_configuration_file(self.config_file)
     parse_yaml_configuration(config_file, configuration=None)
Example #5
0
 def test_config_read(self):
     config_file = read_configuration_file(self.config_file)