25.10.2013 Views

GAMS Python API documentation version 24.1

GAMS Python API documentation version 24.1

GAMS Python API documentation version 24.1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.15 gams.execution.GamsJob Class Reference 31<br />

Get GamsWorkspace containing GamsJob.<br />

• out_db property(get_out_db)<br />

Get GamsDatabase created by run method.<br />

4.15.1 Detailed Description<br />

The GamsJob class manages the execution of a <strong>GAMS</strong> program given by <strong>GAMS</strong> model source.<br />

The <strong>GAMS</strong> source (or more precisely the root of a model source tree) of the job can be provided as a string or<br />

by a filename (relative to the working directory of the GamsWorkspace) of a text file containing the <strong>GAMS</strong> model<br />

source. The run method organizes the export of the input GamsDatabases, calls the <strong>GAMS</strong> compiler and execution<br />

system with the supplied options and on successful completion provides through the property out_db (of type Gams-<br />

Database) the results of the model run.<br />

While the result data is captured in a GamsDatabase, the run method can also create a GamsCheckpoint that not<br />

only captures data but represents the state of the entire GamsJob and allows some other GamsJob to continue<br />

from this state. In case of a compilation or execution error, the run method will throw an exception. If the log output<br />

of <strong>GAMS</strong> is of interest, this can be captured by providing the output parameter of the run method (e.g. sys.stdout).<br />

4.15.2 Constructor & Destructor Documentation<br />

4.15.2.1 def gams.execution.GamsJob. init ( self, ws, file name = None, source = None, checkpoint = None,<br />

job name = None )<br />

Constructor.<br />

Note<br />

It is not allowed to specify both file_name and source at the same time.<br />

Parameters<br />

ws GamsWorkspace containing GamsJob<br />

file_name <strong>GAMS</strong> source file name<br />

source <strong>GAMS</strong> model as string<br />

checkpoint GamsCheckpoint to initialize GamsJob from<br />

job_name Job name (determined automatically if omitted)<br />

4.15.3 Member Function Documentation<br />

4.15.3.1 def gams.execution.GamsJob.interrupt ( self )<br />

Send Interrupt to running Job.<br />

Returns<br />

False if no process available, True otherwise<br />

4.15.3.2 def gams.execution.GamsJob.run ( self, gams options = None, checkpoint = None, output = None,<br />

create out db = True, databases = None )<br />

Run GamsJob.<br />

<strong>GAMS</strong><strong>Python</strong><strong>API</strong> <strong>documentation</strong> <strong>version</strong> <strong>24.1</strong> May 2013

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!