示例#1
0
    def test_config_with_non_recurse_values(self):
        c = Configuration()
        c.exec_timeout(20).batch_time(300).ignore_file("file1").ignore_files(["file2", "file3"])
        c.stepback().command_type("setup")

        obj = c.to_map()

        assert obj["exec_timeout_secs"] == 20
        assert obj["batchtime"] == 300
        assert "file1" in obj["ignore"]
        assert "file2" in obj["ignore"]
        assert "file3" in obj["ignore"]
        assert obj["stepback"]
        assert obj["command_type"] == "setup"
        assert "tasks" not in obj
示例#2
0
    def all_tasks_modern(tasks: List[GeneratedTask]) -> Configuration:
        c = Configuration()
        c.exec_timeout(64800)  # 18 hours
        for task in tasks:
            bootstrap = {
                "test_control": task.name,
                "auto_workload_path": task.workload.relative_path,
            }
            if task.mongodb_setup:
                bootstrap["mongodb_setup"] = task.mongodb_setup

            t = c.task(task.name)
            t.priority(5)
            t.commands([
                CommandDefinition().function("f_run_dsi_workload").vars(
                    bootstrap)
            ])
        return c
示例#3
0
    def all_tasks_modern(tasks: List[GeneratedTask]) -> Configuration:
        c = Configuration()
        c.exec_timeout(64800)  # 18 hours
        for task in tasks:
            bootstrap = {
                "test_control": task.name,
                "auto_workload_path": task.workload.relative_path,
            }
            if task.bootstrap_key:
                bootstrap[task.bootstrap_key] = task.bootstrap_value

            t = c.task(task.name)
            t.priority(5)
            t.commands([
                CommandDefinition().command("timeout.update").params({
                    "exec_timeout_secs":
                    86400,
                    "timeout_secs":
                    7200
                }),  # 24 hours
                CommandDefinition().function("f_run_dsi_workload").vars(
                    bootstrap),
            ])
        return c
示例#4
0
def construct_all_tasks_json():
    """
    :return: json representation of tasks for all workloads in the /src/workloads directory relative to the genny root.
    """
    c = Configuration()
    c.exec_timeout(64800)  # 18 hours

    workload_dir = '{}/src/workloads'.format(get_project_root())
    all_workloads = glob.glob('{}/**/*.yml'.format(workload_dir),
                              recursive=True)
    all_workloads = [s.split('/src/workloads/')[1] for s in all_workloads]

    for fname in all_workloads:
        basename = os.path.basename(fname)
        base_parts = os.path.splitext(basename)
        if base_parts[1] != '.yml':
            # Not a .yml workload file, ignore it.
            continue

        task_name = to_snake_case(base_parts[0])

        prepare_environment_vars = get_prepare_environment_vars(
            task_name, fname)

        for prep_var in prepare_environment_vars:
            t = c.task(prep_var['test'])
            t.priority(5)  # The default priority in system_perf.yml
            t.commands([
                CommandDefinition().function('prepare environment').vars(
                    prep_var),
                CommandDefinition().function('deploy cluster'),
                CommandDefinition().function('run test'),
                CommandDefinition().function('analyze'),
            ])

    return c.to_json()
示例#5
0
    def test_invalid_exec_timeout(self):
        c = Configuration()

        with pytest.raises(TypeError):
            c.exec_timeout("hello world")