# Copyright 2022-2026 The Ramble Authors
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
import os
import pytest
from ramble.main import RambleCommand
# everything here uses the mock_workspace_path
pytestmark = pytest.mark.usefixtures("mutable_config", "mutable_mock_workspace_path")
workspace = RambleCommand("workspace")
[docs]
def test_vector_workloads(make_workspace_from_config):
test_config = """
ramble:
variables:
mpi_command: 'mpirun -n {n_ranks} -ppn {processes_per_node}'
batch_submit: 'batch_submit {execute_experiment}'
partition: 'part1'
processes_per_node: '16'
n_threads: '1'
applications:
hostname:
workloads:
'{application_workload}':
experiments:
simple_test:
variables:
application_workload: ['parallel' ,'serial', 'local']
n_nodes: 1
software:
packages: {}
environments: {}
"""
ws, ws_name = make_workspace_from_config(test_config)
workspace("setup", "--dry-run", global_args=["-w", ws_name])
experiment_root = ws.experiment_dir
expected_workloads = ["parallel", "serial", "local"]
for workload in expected_workloads:
exp1_dir = os.path.join(experiment_root, "hostname", workload, "simple_test")
exp1_script = os.path.join(exp1_dir, "execute_experiment")
assert os.path.isfile(exp1_script)