public class GRBBatch
extends java.lang.Object
Commonly used methods on the batch object include update
(refresh attributes from the Cluster
Manager), abort
(abort execution of a
batch request), retry
(retry
optimization for an interrupted or failed batch request), discard
(remove the batch request and all
related information from the Cluster Manager), and getJSONSolution
(query solution
information for the batch request).
These methods are built on top of calls to the Cluster Manager REST API. They are meant to simplify such calls, but note that you always have the option of calling the REST API directly.
Batch objects have four attributes:
You can access their values by using get
.
Note that all Batch attributes are locally cached, and are only
updated when you create a client-side batch object or when you
explicitly update this cache, which can done by calling update
.
While the Java garbage collector will eventually collect an unused
GRBBatch
object, the vast majority of the memory associated
with a model is stored outside of the Java heap. As a result, the
garbage collector can't see this memory usage, and thus it can't take
this quantity into account when deciding whether collection is
necessary. We recommend that you call GRBBatch.dispose
when you are done with the batch.
Constructor and Description |
---|
GRBBatch(GRBEnv env,
java.lang.String batchID) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
This method instructs the Cluster Manager to abort the processing of
this batch request, changing its status to ABORTED.
|
void |
discard()
This method instructs the Cluster Manager to remove all information
related to the batch request in question, including the stored
solution if available.
|
void |
dispose()
Free all resources associated with this Batch object.
|
protected void |
finalize() |
int |
get(GRB.IntAttr attr)
Query the value of an int-valued batch attribute.
|
java.lang.String |
get(GRB.StringAttr attr)
Query the value of a string-valued batch attribute.
|
java.lang.String |
getJSONSolution() |
void |
retry()
This method instructs the Cluster Manager to retry optimization of a
failed or aborted batch request, changing its status to
SUBMITTED.
|
void |
update()
All Batch attribute values are cached locally, so queries return the
value received during the last communication with the Cluster Manager.
|
void |
writeJSONSolution(java.lang.String filename) |
public GRBBatch(GRBEnv env, java.lang.String batchID) throws GRBException
env
- The environment in which the new batch object should be created.batchID
- ID of the batch request for which you want to access status and other
information.GRBException
public void writeJSONSolution(java.lang.String filename) throws GRBException
filename
- Name of file where the solution should be stored (in JSON format).GRBException
public java.lang.String getJSONSolution() throws GRBException
GRBException
public void update() throws GRBException
GRBException
public void abort() throws GRBException
GRBException
public void retry() throws GRBException
GRBException
public void discard() throws GRBException
GRBException
public void dispose()
protected void finalize()
finalize
in class java.lang.Object
public int get(GRB.IntAttr attr) throws GRBException
attr
- The attribute being queried.GRBException
public java.lang.String get(GRB.StringAttr attr) throws GRBException
attr
- The attribute being queried.GRBException