diff --git a/acto/engine.py b/acto/engine.py index fc9d35a476..bc6204d486 100644 --- a/acto/engine.py +++ b/acto/engine.py @@ -565,6 +565,13 @@ def run_trial( generation, ) if run_result.oracle_result.is_error(): + + # is alarm, alarm count plus one + if self.alarm_counter is not None and not run_result.is_invalid_input(): + self.alarm_counter.increment() + logger.info(f"Alarm count plus one, current count is {self.alarm_counter.get_count()}") + + # before return, run the recovery test case logger.info("Error result, running recovery") run_result.oracle_result.differential = self.run_recovery( @@ -578,10 +585,6 @@ def run_trial( duration=time.time() - trial_start_time, error=run_result.oracle_result, ) - - if not run_result.is_invalid_input() and run_result.oracle_result.is_error(): - logger.info("Alarm count plus one") - self.alarm_counter.increment() if self.input_model.is_empty(): logger.info("Input model is empty, break") diff --git a/acto/utils/early_stop.py b/acto/utils/early_stop.py index a06649406f..a2c8750732 100644 --- a/acto/utils/early_stop.py +++ b/acto/utils/early_stop.py @@ -13,6 +13,9 @@ def increment(self, value=1): with self.lock: self.count += value + def get_count(self): + return self.count + def judge(self, work_id): if self.count >= self.bound: # print(f"Counter of thread {work_id} reached the number of alarms {self.bound}.")