How to use the chaostoolkit.probes.get_probe_from_step function in chaostoolkit

To help you get started, we’ve selected a few chaostoolkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chaostoolkit / chaostoolkit / chaostoolkit / plan.py View on Github external
def apply_close_probe(step: Dict[str, Any], layers: Dict[str, Layer]):
    """
    Apply the close probe found in this step. If none is defined, does
    nothing.

    When the name of the probe is not recognized, fails the call with an
    :exc:`UnknownProbe` exception.
    """
    probe = get_probe_from_step(step, "close")
    if probe is None:
        return

    if "name" not in probe:
        raise InvalidPlan("close probe requires a probe name to apply")

    if "layer" not in probe:
        raise InvalidPlan("close probe requires the target layer to be set")

    if probe:
        probe_name = probe.pop("name")
        layer = layers.get(probe["layer"])
        logger.info(" Applying close probe '{name}'".format(name=probe_name))
        apply_probe(probe_name, probe, layer)
github chaostoolkit / chaostoolkit / chaostoolkit / plan.py View on Github external
def apply_steady_probe(step: Dict[str, Any], layers: Dict[str, Layer]):
    """
    Apply the steady probe found in this step. If none is defined, does
    nothing.

    When the name of the probe is not recognized, fails the call with an
    :exc:`UnknownProbe` exception.
    """
    probe = get_probe_from_step(step, "steady")
    if probe is None:
        return

    if "name" not in probe:
        raise InvalidPlan("steady probe requires a probe name to apply")

    if "layer" not in probe:
        raise InvalidPlan("steady probe requires the target layer to be set")

    if probe:
        probe_name = probe.pop("name")
        layer = layers.get(probe["layer"])
        logger.info(" Applying steady probe '{name}'".format(name=probe_name))
        apply_probe(probe_name, probe, layer)