本文整理汇总了Java中org.ggf.drmaa.Session.DONE属性的典型用法代码示例。如果您正苦于以下问题:Java Session.DONE属性的具体用法?Java Session.DONE怎么用?Java Session.DONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.ggf.drmaa.Session
的用法示例。
在下文中一共展示了Session.DONE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: statustoString
public String statustoString(int jobstatus) {
switch (jobstatus) {
case Session.QUEUED_ACTIVE:
return "Job is pending";
case Session.SYSTEM_ON_HOLD:
return "Job is on hold by system.";
case Session.USER_ON_HOLD:
return "Job is on hold by user.";
case Session.USER_SYSTEM_ON_HOLD:
return "Job is on hold by system or user.";
case Session.RUNNING:
return "Job is running";
case Session.SYSTEM_SUSPENDED:
return "Job is suspended by system.";
case Session.USER_SUSPENDED:
return "Job is suspended by user.";
case Session.USER_SYSTEM_SUSPENDED:
return "Job is suspended by system or user.";
case Session.DONE:
return "Job has completed";
case Session.FAILED:
return "Job has failed.";
}
return "Job status is unknown";
}
示例2: getCompletedInstances
@Override
public int getCompletedInstances() {
int comp = 0;
try {
for (String job : jobs) {
int status = session.getJobProgramStatus(job);
//if( status == session.FAILED )
//System.err.println( "[" + job + "] failed." );
if (status == Session.DONE || status == Session.FAILED) {
comp += 1;
}
}
} catch (DrmaaException e) {
return 0;
}
return comp;
}
示例3: getRunningInstances
@Override
public int getRunningInstances() {
int comp = 0;
try {
for (String job : jobs) {
int status = session.getJobProgramStatus(job);
comp += 1;
//if( status == session.FAILED )
//System.err.println( "[" + job + "] failed." );
if (status == Session.QUEUED_ACTIVE || status == Session.DONE || status == Session.FAILED) {
comp -= 1;
}
}
} catch (DrmaaException e) {
return 0;
}
return comp;
}
示例4: getRunTimes
@Override
public synchronized List<Double> getRunTimes() {
ArrayList<Double> times = new ArrayList<>();
long current;
if (startTimes != null) {
for (String jobid : startTimes.keySet()) {
try {
int status = session.getJobProgramStatus(jobid);
long start = startTimes.get(jobid);
if (status == Session.DONE || status == Session.FAILED) {
if (!stopTimes.containsKey(jobid)) {
stopTimes.put(jobid, System.currentTimeMillis());
}
current = stopTimes.get(jobid);
} else {
current = System.currentTimeMillis();
}
double diff = (current - start + 0.0) / 1000.0;
times.add(diff);
} catch (DrmaaException e) {
logger.log(Level.WARNING, e.getMessage(), e);
}
}
}
return times;
}
示例5: checkJob
private void checkJob(FailAction fail, JobSpecification js) throws DrmaaException {
String id = js.getJobId();
int status = session.getJobProgramStatus(id);
if (status == Session.DONE) {
JobInfo info = session.wait(id, Session.TIMEOUT_NO_WAIT);
if (info.wasAborted()) {
logger.warning(js.getJobMessage("was aborted"));
fail(fail, js);
return;
}
if (info.hasSignaled()) {
logger.warning(js.getJobMessage("signalled " + info.getTerminatingSignal()));
fail(fail, js);
return;
}
if (info.getExitStatus() != 0) {
logger.warning(js.getJobMessage("exited with status " + info.getExitStatus()));
fail(fail, js);
return;
}
logger.info(js.getJobMessage("is done"));
currentJobs.remove(id);
return;
}
if (status == Session.FAILED) {
logger.warning(js.getJobMessage("failed somehow"));
fail(fail, js);
}
}
示例6: getExceptions
@Override
public ArrayList<Exception> getExceptions() {
for (String job : jobs) {
try {
int status = session.getJobProgramStatus(job);
if (status == Session.FAILED) {
exceptions.add(new Exception("[" + job + "] failed -- see stderr folder."));
System.err.println("[" + job + "] failed -- see stderr folder.");
} else if (status == Session.DONE) {
// check for X.complete
File checkpoint = jobCheckpoints.get(job);
boolean exists = false;
int count = 0;
do {
if (checkpoint.exists()) {
exists = true;
break;
}
try {
Thread.sleep(1000); // wait 1 second
} catch (InterruptedException ignored) {
// Don't care about interruption errors
}
} while (count++ < 60); // 1 min timeout
// if the job finished over a minute ago, and the checkpoint still doesn't exist - it probably errored.
if (!exists) {
// add an exception.
exceptions.add(new Exception("[" + job + "] failed -- checkpoint does not exist."));
System.err.println("[" + job + "] failed -- checkpoint does not exist.");
}
}
} catch (DrmaaException e) {
System.err.println("Could not error check the drmaa session!");
}
}
return exceptions;
}
示例7: getJobProgramStatus
@Override
public int getJobProgramStatus(String jobId) throws DrmaaException {
Job job = parseJobs(jobId).get(0);
/**
* PBS Professional S The job's state:
*
* B Array job has at least one subjob running.
*
* E Job is exiting after having run.
*
* F Job is finished.
*
* H Job is held.
*
* M Job was moved to another server.
*
* Q Job is queued.
*
* R Job is running.
*
* S Job is suspended.
*
* T Job is being moved to new location.
*
* U Cycle-harvesting job is suspended due to keyboard activity.
*
* W Job is waiting for its submitter-assigned start time to be reached.
*
* X Subjob has completed execution or has been deleted.
*
*/
String state = job.getState();
LOGGER.finest("state : " + state);
switch (state) {
case "B":
return Session.RUNNING;
case "E":
return Session.RUNNING;
case "F":
return job.getExitStatus() == 0 ? Session.DONE : Session.FAILED;
case "H":
return Session.SUSPEND;
case "M":
return Session.RUNNING;
case "Q":
return Session.QUEUED_ACTIVE;
case "R":
return Session.RUNNING;
case "S":
return Session.SUSPEND;
case "T":
return Session.RUNNING;
case "U":
return Session.SUSPEND;
case "W":
return Session.QUEUED_ACTIVE;
case "X":
return job.getExitStatus() == 0 ? Session.DONE : Session.FAILED;
}
return Session.UNDETERMINED;
}
示例8: succeeded
@Override
public boolean succeeded() throws IOException, InterruptedException, DrmaaException {
int status = session.getJobProgramStatus(jobID);
return status == Session.DONE;
}