public class GRBBatch extends 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.
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.
|
String |
get(GRB.StringAttr attr)
Query the value of a string-valued batch attribute.
|
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(String filename) |
public GRBBatch(GRBEnv env, 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(String filename) throws GRBException
filename
- Name of file where the solution should be stored (in JSON format).GRBException
public 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()
public int get(GRB.IntAttr attr) throws GRBException
attr
- The attribute being queried.GRBException
public String get(GRB.StringAttr attr) throws GRBException
attr
- The attribute being queried.GRBException
Copyright © 2024. All rights reserved.