Skip to content

Commit

Permalink
warning logs on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ruaronicola committed Nov 16, 2023
1 parent 77c19dc commit 0ca077d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions greed/solver/solver.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import logging
import threading

from greed import options

from yices.YicesException import YicesException

log = logging.getLogger(__name__)


class Solver:
@staticmethod
def solver_timeout(func):
def raise_solver_timeout(self):
self.solver.stop_search()
log.warning("Solver timeout, stopping search")

def wrap(self, *args, **kwargs):
# start a timer to stop solving if the solver takes too long
Expand All @@ -19,6 +23,7 @@ def wrap(self, *args, **kwargs):
result = func(self, *args, **kwargs)
return result
except YicesException:
log.warning("Something went wrong with the solver, returning False")
return False
finally:
timer.cancel()
Expand Down

0 comments on commit 0ca077d

Please sign in to comment.