diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b1b8b1..c71d353 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [Unreleased][] -[Unreleased]: https://github.com/chaostoolkit/chaostoolkit-addons/compare/0.8.4...HEAD +[Unreleased]: https://github.com/chaostoolkit/chaostoolkit-addons/compare/0.8.5...HEAD + +## [0.8.5][] + +[0.8.5]: https://github.com/chaostoolkit/chaostoolkit-addons/compare/0.8.4...0.8.5 + +### Changed + +* Make safeguard probe that got triggered available to review ## [0.8.4][] diff --git a/chaosaddons/controls/safeguards.py b/chaosaddons/controls/safeguards.py index 04213b9..88590ff 100644 --- a/chaosaddons/controls/safeguards.py +++ b/chaosaddons/controls/safeguards.py @@ -80,6 +80,7 @@ calls for too long. """ from concurrent.futures import Future, ThreadPoolExecutor +from copy import deepcopy from datetime import datetime from functools import partial import sys @@ -113,6 +114,8 @@ def __init__(self) -> None: self._interrupted = False self._setup = False self.triggered_by = None + self.triggered_by_run = None + self.was_triggered = False @property def interrupted(self) -> bool: @@ -192,9 +195,11 @@ def run(self, experiment: Experiment, probes: List[Probe], # this allows the experiment to block until these are passed self.now_all_done.wait() - def interrupt_now(self, triggered_by: str) -> None: + def interrupt_now(self, triggered_by: str, run: Run) -> None: with self._lock: self.triggered_by = triggered_by + self.triggered_by_run = deepcopy(run) + self.was_triggered = True self.wait_for_interruption.set() @@ -205,7 +210,7 @@ def _wait_interruption(self) -> None: if experiment_finished.is_set(): return None - if not self.triggered_by: + if not self.was_triggered: return None with self._lock: @@ -335,7 +340,7 @@ def interrupt_experiment_on_unhealthy_probe(guard: Guardian, probe: Probe, tolerance, run["output"], configuration=configuration, secrets=secrets) if not checked: - guard.interrupt_now(probe["name"]) + guard.interrupt_now(probe["name"], run) def execute_activity(experiment: Experiment, probe: Probe, diff --git a/setup.py b/setup.py index fcc56d7..e212968 100644 --- a/setup.py +++ b/setup.py @@ -5,5 +5,5 @@ setup( use_scm_version=True, name="chaostoolkit-addons", - version="0.8.4", + version="0.8.5", )