The GamsJob class manages the execution of a GAMS program given by GAMS model source. More...
Public Member Functions | |
def | __init__ (self, ws, file_name=None, source=None, checkpoint=None, job_name=None) |
Constructor. | |
def | run (self, gams_options=None, checkpoint=None, output=None, create_out_db=True, databases=None) |
Run GamsJob. | |
def | run_engine (self, engine_configuration, extra_model_files=None, engine_options=None, gams_options=None, checkpoint=None, output=None, create_out_db=True, databases=None, remove_results=True) |
Run GamsJob on GAMS Engine. | |
def | interrupt (self) |
Send Interrupt to running Job. | |
Detailed Description
The GamsJob class manages the execution of a GAMS program given by GAMS model source.
The GAMS source (or more precisely the root of a model source tree) of the job can be provided as a string or by a filename (relative to the working directory of the GamsWorkspace) of a text file containing the GAMS model source. The run method organizes the export of the input GamsDatabases, calls the GAMS compiler and execution system with the supplied options and on successful completion provides through the property out_db (of type GamsDatabase) the results of the model run.
While the result data is captured in a GamsDatabase, the run method can also create a GamsCheckpoint that not only captures data but represents the state of the entire GamsJob and allows some other GamsJob to continue from this state. In case of a compilation or execution error, the run method will throw an exception. If the log output of GAMS is of interest, this can be captured by providing the output parameter of the run method (e.g. sys.stdout).
Constructor & Destructor Documentation
◆ __init__()
def gams.control.execution.GamsJob.__init__ | ( | self, | |
ws, | |||
file_name = None , |
|||
source = None , |
|||
checkpoint = None , |
|||
job_name = None |
|||
) |
Constructor.
- Note
- It is not allowed to specify both file_name and source at the same time.
- Parameters
-
ws GamsWorkspace containing GamsJob file_name GAMS source file name source GAMS model as string checkpoint GamsCheckpoint to initialize GamsJob from job_name Job name (determined automatically if omitted)
Member Function Documentation
◆ interrupt()
def gams.control.execution.GamsJob.interrupt | ( | self | ) |
Send Interrupt to running Job.
Note: On Mac OS this call requires the tool pstree to be installed
- Returns
- False if no process available, True otherwise
◆ run()
def gams.control.execution.GamsJob.run | ( | self, | |
gams_options = None , |
|||
checkpoint = None , |
|||
output = None , |
|||
create_out_db = True , |
|||
databases = None |
|||
) |
Run GamsJob.
- Parameters
-
gams_options GAMS options to control job checkpoint GamsCheckpoint to be created by GamsJob output Stream to capture GAMS log (e.g. sys.stdout or an object created by the build-in function open()) create_out_db Flag to define if out_db should be created databases Either a GamsDatabase or a list of GamsDatabases to be read by the GamsJob
◆ run_engine()
def gams.control.execution.GamsJob.run_engine | ( | self, | |
engine_configuration, | |||
extra_model_files = None , |
|||
engine_options = None , |
|||
gams_options = None , |
|||
checkpoint = None , |
|||
output = None , |
|||
create_out_db = True , |
|||
databases = None , |
|||
remove_results = True |
|||
) |
Run GamsJob on GAMS Engine.
- Parameters
-
engine_configuration GamsEngineConfiguration object extra_model_files List of additional file paths (apart from main file) required to run the model (e.g. include files) engine_options Dictionary of GAMS Engine options to control job execution gams_options GAMS options to control job checkpoint GamsCheckpoint to be created by GamsJob output Stream to capture GAMS log (e.g. sys.stdout or an object created by the build-in function open()) create_out_db Flag to define if out_db should be created databases Either a GamsDatabase or a list of GamsDatabases to be read by the GamsJob remove_results Remove results from GAMS Engine after downloading them