Python API: view solver output

Hi everyone,

I have a workflow running GAMS models using the Python 3.6 API. I am looking for a way to inspect the solver progress, the same way you would when running a GAMS job in the IDE. Is there a class or method in the Python API to enable this type of output? This will assist in debugging the model, etc.

This topic may be related to this previous topic https://newforum.gams.com/t/python-api-jupyter-solver-log/1789/1 I also searched the Python API documentation https://www.gams.com/latest/docs/API_PY_TUTORIAL.html. Perhaps I missed the class reference. Thanks!

David

David,

The GAMSJob.run method has an (optional) argument output. You pass in a stream, e.g. sys.stdout, and viola the GAMS log including the solver log appears on stdout. You can use other streams , including files to capture the log more permanently. This has been asked often enough that in the new GAMS 31 (currently in beta) we added a section to mention this explicitly: https://www.gams.com/beta/docs/API_PY_TUTORIAL.html#PY_RUN_JOB_SOLVER_OPTION_FILE

-Michael

Michael,

Thank you for the pointer – the output argument worked and is very convenient!

Many thanks,

David