예제 #1
0
                           sort_keys=False)
    else:
        output = json.dumps(base_experiment, indent=4, default=encoder)

    with open(experiment_path, "w") as e:
        e.write(output)

    click.echo(
        "\nExperiment created and saved in '{e}'".format(e=experiment_path))

    notify(settings, InitFlowEvent.InitCompleted, base_experiment)
    return base_experiment


# keep this after the cli group declaration for plugins to override defaults
with_plugins(iter_entry_points('chaostoolkit.cli_plugins'))(cli)


def is_yaml(experiment_path: str) -> bool:
    _, ext = os.path.splitext(experiment_path)
    return ext.lower() in (".yaml", ".yml")


def add_activities(activities: List[Activity], pool: List[Activity],
                   with_tolerance: bool = False):
    """
    Add activities to the given pool.
    """
    base_activity = {
        "type": None,
        "name": None,
예제 #2
0
            base_experiment, indent=4, default_flow_style=False, sort_keys=False
        )
    else:
        output = json.dumps(base_experiment, indent=4, default=encoder)

    with open(experiment_path, "w") as e:
        e.write(output)

    click.echo(f"\nExperiment created and saved in '{experiment_path}'")

    notify(settings, InitFlowEvent.InitCompleted, base_experiment)
    return base_experiment


# keep this after the cli group declaration for plugins to override defaults
with_plugins(importlib_metadata.entry_points().get("chaostoolkit.cli_plugins"))(cli)


def is_yaml(experiment_path: str) -> bool:
    _, ext = os.path.splitext(experiment_path)
    return ext.lower() in (".yaml", ".yml")


def add_activities(
    activities: List[Activity],
    pool: List[Activity],  # noqa: C901
    with_tolerance: bool = False,
):
    """
    Add activities to the given pool.
    """