|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.tools.xgrid.XgridBatch
public class XgridBatch
A collection of XgridCommands that can be submitted to the Xgrid as a batch. The jobs for each of the XgridCommands contained in a batch can be manipulated via the commands in this class making it easy to wait for all of the jobs to complete, get all of the results and delete all of the jobs.
| Constructor Summary | |
|---|---|
XgridBatch(String host,
String password,
String grid)
Create a new batch of XgridCommands. |
|
| Method Summary | |
|---|---|
void |
addCommand(XgridCommand cmd)
Add a new command to this batch of XgridCommands. |
void |
cancelAndResubmit()
Cancel all unfinished or failed jobs and resubmit them. |
void |
deleteAll()
Delete the xgrid jobs for each of the commands in this batch. |
ArrayList<XgridResult> |
getAllResults()
Get the results for all of the xgrid jobs that were submitted for the commands in this batch. |
ArrayList<XgridCommand> |
getCommands()
Get an ArrayList containing all of the XgridCommands that have been added to this batch. |
ArrayList<String> |
getJobIds()
Get the xgrid id numbers that have been assigned to the jobs for all of the commands in this batch. |
XgridResult |
getResult(XgridCommand cmd)
Get the results of the job for the specified XgridCommand. |
boolean |
hasFailures()
Check if any of the jobs for this batch have failed. |
void |
resubmitFailedJobs()
Cancel all failed jobs and resubmit them. |
boolean |
stillRunning()
Check if any of the jobs for this batch are still running. |
void |
submit()
Submit this batch of XgridCommands to the xgrid. |
void |
submitAndWait()
Submit this batch of XgridCommands to the xgrid and wait for all of the jobs to complete (either successfully or unsuccessfully) before returning. |
void |
submitAndWait(int maxTime,
int maxSubmits)
Submit this batch of XGridCommands to the xgrid and wait for all of the jobs to complete successfully. |
boolean |
submitted()
Return true if this batch of commands has already been submitted via the submit or the submitAndWait method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XgridBatch(String host,
String password,
String grid)
host - the hostname of the grid controller to which to submit the
commands. Can be null if the XGRID_CONTROLLER_HOSTNAME
environment variable is set on the machine being used.password - the password for the grid. Can be null if the
XGRID_CONTROLLER_PASSWORD environment variable is set on the
machine being used or the grid does not require a password.grid - the name of the logical grid on which the command will be
run. If this is null the command will be run on the default
grid. Note: xgrid uses numeric gid's to identify the grids.
This is not that id, it is the text name of the grid. This
method will translate automatically to the xgrid gid value.| Method Detail |
|---|
public void addCommand(XgridCommand cmd)
cmd - the XgridCommand to add to the batch
IllegalStateException - if the batch has already been submitted.public boolean submitted()
public void submit()
IllegalStateException - if the batch has already been submitted.public void submitAndWait()
IllegalStateException - if the batch has already been submitted.
public void submitAndWait(int maxTime,
int maxSubmits)
throws XGridFailureException
maxTime - the maximum time (in ms) to wait for all of the jobs to
complete. If the jobs do not complete in this amount of time,
then they will be resubmitted up to maxSubmits-1 times. This
method also waits up to maxTime for each resubmission to
complete.maxSubmits - the maximum number of time to submit the jobs in this
batch. This method will wait up to maxTime for the jobs to
complete. If they do not complete within that time they will
be resubmited up to maxSubmits-1 times.
XGridFailureException - thrown if there are jobs that have not
successfully completed after maxSubmits submissions.public ArrayList<String> getJobIds()
public boolean stillRunning()
IllegalStateException - if any of the XgridCommands have already
been deleted.public boolean hasFailures()
IllegalStateException - if any of the XgridCommands have already
been deleted.public ArrayList<XgridCommand> getCommands()
public XgridResult getResult(XgridCommand cmd)
cmd - the XgridCommand for which to retrieve the results.
IllegalStateException - if this XgridCommand has not yet been
submitted or the job has been deleted.public ArrayList<XgridResult> getAllResults()
IllegalStateException - if this batch of commands has not yet been
submitted or any of the jobs have been deleted.public void deleteAll()
public void cancelAndResubmit()
public void resubmitFailedJobs()
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||