I am running a python application in a docker container that uses pyomo to formulate a mathematical optimization problem and uses the Gurobi-cloud solver (gurobi_direct) to solve the optimization problem.
However, the first few times after building the docker container, the application works fine. But after a while of not using the application (e.g. 1 hour), the application returns the error message below when trying to initialize the gurobi-model and start the gurobi cloud solver.
Traceback (most recent call last):
File "/home/guser/miniconda/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 238, in _set_instance
self._solver_model = self._gurobipy.Model(model.name)
File "model.pxi", line 75, in gurobipy.Model.__init__
gurobipy.GurobiError: Network error
Note that the first time I run the application, i.e. the first time the gurobi solver is used, the log-file shows the following message (note that I modified log-file below to state '[pool id & name]' instead of the actual pool-ID):
------------------------ Start calculation steps -----------------------
Using license file /home/guser/gurobi.lic
INFO:gurobipy:Using license file /home/guser/gurobi.lic
INFO:gurobipy:Set parameter CloudAccessID
Set parameter CloudAccessID
Set parameter CloudSecretKey
Set parameter CloudPool to value [pool id & name]
INFO:gurobipy:Set parameter CloudSecretKey
INFO:gurobipy:Set parameter CloudPool to value [pool id & name]
Waiting for cloud server to start (pool [pool id & name])...
INFO:gurobipy:Waiting for cloud server to start ([pool id & name])...
Starting...
Compute Server job ID: [server Job-ID]
Capacity available on [pool id & name] cloud pool - connecting...
INFO:gurobipy:Capacity available on [pool id & name] cloud pool - connecting...
Established HTTPS encrypted connection
INFO:gurobipy:Established HTTPS encrypted connection
Parameter OutputFlag unchanged
Value: 1 Min: 0 Max: 1 Default: 1
And the subsequent times it states somewhat differently: a warning about the solution status of the previous run, it skips the part about establishing the https-connections and starts with the Outputlag and a log-file.
WARNING: Loading a SolverResults object with an 'aborted' status, but
containing a solution
------------------------- Start calculation steps -----------------------
Parameter OutputFlag unchanged
INFO:gurobipy:Parameter OutputFlag unchanged
Value: 1 Min: 0 Max: 1 Default: 1
INFO:gurobipy: Value: 1 Min: 0 Max: 1 Default: 1
Changed value of parameter LogFile to /tmp/tmp0fd91rm9.log
INFO:gurobipy:Changed value of parameter LogFile to /tmp/tmp0fd91rm9.log
Prev: Default:
I have the feeling that the gurobi-client in the docker-containers remembers the job-ID of the gurobi-cloud server, even after the shutdown of the cloud-server due to idle time. Such that a next day, the docker tries to access a cloud-server machine with the old job-ID, but the old Job-ID is no longer valid.