Skip to content

Commit

Permalink
modify logic of alarm counter
Browse files Browse the repository at this point in the history
  • Loading branch information
RenZhou0327 committed May 1, 2024
1 parent ccc7b70 commit f85aad4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions acto/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")

Check warning on line 572 in acto/engine.py

View workflow job for this annotation

GitHub Actions / coverage-report

Missing coverage

Missing coverage on lines 570-572


# before return, run the recovery test case
logger.info("Error result, running recovery")
run_result.oracle_result.differential = self.run_recovery(
Expand All @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions acto/utils/early_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def increment(self, value=1):
with self.lock:
self.count += value

Check warning on line 14 in acto/utils/early_stop.py

View workflow job for this annotation

GitHub Actions / coverage-report

Missing coverage

Missing coverage on lines 13-14

def get_count(self):
return self.count

Check warning on line 17 in acto/utils/early_stop.py

View workflow job for this annotation

GitHub Actions / coverage-report

Missing coverage

Missing coverage on line 17

def judge(self, work_id):
if self.count >= self.bound:
# print(f"Counter of thread {work_id} reached the number of alarms {self.bound}.")
Expand Down

0 comments on commit f85aad4

Please sign in to comment.