BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization
https://machinelearning.byu.edu
Other
573 stars 102 forks source link

Minor bug in catching TimeOut #108

Open ajkswamy opened 3 years ago

ajkswamy commented 3 years ago

TimeoutExpired :arrow_right: subprocess.TimeoutExpired on this line (context copied below as well)

                if ver == 2:  # Python 2 doesn't have timeout
                    outs, errs = app.communicate()
                else:  # Python 3+              
                    # limit max time to 1e6
                    max_time = min(1e6,self.options.max_time)
                    try:
                        outs, errs = app.communicate(timeout=max_time)
                    except TimeoutExpired:
                        app.kill()
                        outs, errs = app.communicate()
                        raise Exception('Time Limit Exceeded: ' + str(max_time))
                if '@error' in outs:
                    i = outs.find('@error')
                    apm_error = outs[i:]
                    record_error = True