use of org.apache.airavata.model.status.JobStatus in project airavata by apache.
the class HPCRemoteCluster method cancelJob.
@Override
public JobStatus cancelJob(String jobId) throws GFacException {
JobStatus oldStatus = getJobStatus(jobId);
RawCommandInfo cancelCommand = jobManagerConfiguration.getCancelCommand(jobId);
StandardOutReader reader = new StandardOutReader();
executeCommand(cancelCommand, reader);
throwExceptionOnError(reader, cancelCommand);
return oldStatus;
}
use of org.apache.airavata.model.status.JobStatus in project airavata by apache.
the class LSFOutputParser method main.
public static void main(String[] args) {
String test = "Job <2477982> is submitted to queue <short>.";
System.out.println(test.substring(test.indexOf("<") + 1, test.indexOf(">")));
String test1 = "JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME\n" + "2636607 lg11w RUN long ghpcc06 c11b02 *069656647 Mar 7 00:58\n" + "2636582 lg11w RUN long ghpcc06 c02b01 2134490944 Mar 7 00:48";
Map<String, JobStatus> statusMap = new HashMap<String, JobStatus>();
statusMap.put("2477983,2134490944", new JobStatus(JobState.UNKNOWN));
LSFOutputParser lsfOutputParser = new LSFOutputParser();
try {
lsfOutputParser.parseJobStatuses("cjh", statusMap, test1);
} catch (GFacException e) {
logger.error(e.getMessage(), e);
}
System.out.println(statusMap.get("2477983,2134490944"));
}
use of org.apache.airavata.model.status.JobStatus in project airavata by apache.
the class PBSOutputParser method parseJobStatuses.
public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) {
log.debug(rawOutput);
String[] info = rawOutput.split("\n");
// int lastStop = 0;
for (String jobID : statusMap.keySet()) {
String jobName = jobID.split(",")[1];
boolean found = false;
for (int i = 0; i < info.length; i++) {
if (info[i].contains(jobName.substring(0, 8))) {
// now starts processing this line
log.info(info[i]);
String correctLine = info[i];
String[] columns = correctLine.split(" ");
List<String> columnList = new ArrayList<String>();
for (String s : columns) {
if (!"".equals(s)) {
columnList.add(s);
}
}
// lastStop = i + 1;
try {
statusMap.put(jobID, new JobStatus(JobUtil.getJobState(columnList.get(9))));
} catch (IndexOutOfBoundsException e) {
statusMap.put(jobID, new JobStatus(JobUtil.getJobState("U")));
}
found = true;
break;
}
}
if (!found)
log.error("Couldn't find the status of the Job with JobName: " + jobName + "Job Id: " + jobID.split(",")[0]);
}
}
use of org.apache.airavata.model.status.JobStatus in project airavata by apache.
the class SlurmOutputParser method parseJobStatuses.
public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) throws GFacException {
log.debug(rawOutput);
String[] info = rawOutput.split("\n");
String lastString = info[info.length - 1];
if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
log.info("There are no jobs with this username ... ");
return;
}
// int lastStop = 0;
for (String jobID : statusMap.keySet()) {
String jobId = jobID.split(",")[0];
String jobName = jobID.split(",")[1];
boolean found = false;
for (int i = 0; i < info.length; i++) {
if (info[i].contains(jobName.substring(0, 8))) {
// now starts processing this line
log.info(info[i]);
String correctLine = info[i];
String[] columns = correctLine.split(" ");
List<String> columnList = new ArrayList<String>();
for (String s : columns) {
if (!"".equals(s)) {
columnList.add(s);
}
}
try {
statusMap.put(jobID, new JobStatus(JobState.valueOf(columnList.get(4))));
} catch (IndexOutOfBoundsException e) {
statusMap.put(jobID, new JobStatus(JobState.valueOf("U")));
}
found = true;
break;
}
}
if (!found) {
log.error("Couldn't find the status of the Job with JobName: " + jobName + "Job Id: " + jobId);
}
}
}
use of org.apache.airavata.model.status.JobStatus in project airavata by apache.
the class UGEOutputParser method parseJobStatus.
public JobStatus parseJobStatus(String jobID, String rawOutput) {
Pattern pattern = Pattern.compile("job_number:[\\s]+" + jobID);
Matcher matcher = pattern.matcher(rawOutput);
if (matcher.find()) {
// fixme; return correct status.
return new JobStatus(JobState.QUEUED);
}
return new JobStatus(JobState.UNKNOWN);
}
Aggregations