Skip to content

Commit

Permalink
Temporarily removed async from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mapgccv committed Feb 23, 2024
1 parent 0275be5 commit ac2001b
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions test/end2end/scripts/python/AMPLRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from shutil import which

from Solver import Solver
from amplpy import AMPL, Kind, OutputHandler, ErrorHandler, ampl
from amplpy import AMPL, Kind, OutputHandler, ErrorHandler, Runnable
from Model import Model
import time
from TimeMe import TimeMe
Expand Down Expand Up @@ -91,21 +91,22 @@ def readModel(self, model: Model):
if not mp.exists():
raise Exception("Model {} not found".format(model.getFilePath()))
if model.isScript():
class MyInterpretIsOver(Runnable):
executed = False
def run(self):
self.executed = True
mutex.release()
callback = MyInterpretIsOver()
mutex = Lock()
mutex.acquire()
timeOut = self._solver.getTimeout()
self._ampl.evalAsync("include '{}';".format(str(mp.absolute().resolve())), callback)
mutex.acquire(timeout=timeOut)
if not callback.executed:
self._ampl.interrupt()
self._ampl.interrupt()
return None

# class MyInterpretIsOver(Runnable):
# executed = False
# def run(self):
# self.executed = True
# mutex.release()
# callback = MyInterpretIsOver()
# mutex = Lock()
# mutex.acquire()
# timeOut = self._solver.getTimeout()
self._ampl.eval("include '{}';".format(str(mp.absolute().resolve())))
# mutex.acquire(timeout=timeOut)
# if not callback.executed:
# self._ampl.interrupt()
# self._ampl.interrupt()
# return None
else:
self._ampl.read(str(mp.absolute().resolve()))
files = model.getAdditionalFiles()
Expand Down

0 comments on commit ac2001b

Please sign in to comment.