use of edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail in project tetrad by cmu-phil.
the class HpcJobManager method logHpcJobLogDetail.
public void logHpcJobLogDetail(final HpcJobLog hpcJobLog, int jobStatus, String jobProgress) {
Date now = new Date(System.currentTimeMillis());
hpcJobLog.setLastUpdatedTime(now);
if (jobStatus == 3) {
// Finished
hpcJobLog.setEndedTime(now);
}
if (jobStatus == 4) {
// Killed
hpcJobLog.setCanceledTime(now);
}
updateHpcJobLog(hpcJobLog);
HpcJobLogDetail hpcJobLogDetail = new HpcJobLogDetail();
hpcJobLogDetail.setAddedTime(new Date(System.currentTimeMillis()));
hpcJobLogDetail.setHpcJobLog(hpcJobLog);
hpcJobLogDetail.setJobState(jobStatus);
hpcJobLogDetail.setProgress(jobProgress);
appendHpcJobLogDetail(hpcJobLogDetail);
}
use of edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail in project tetrad by cmu-phil.
the class HpcJobManager method submitNewHpcJobToQueue.
public synchronized void submitNewHpcJobToQueue(final HpcJobInfo hpcJobInfo, final GeneralAlgorithmEditor generalAlgorithmEditor) {
hpcJobInfoService.add(hpcJobInfo);
LOGGER.debug("hpcJobInfo: id: " + hpcJobInfo.getId());
HpcJobLog hpcJobLog = new HpcJobLog();
hpcJobLog.setAddedTime(new Date(System.currentTimeMillis()));
hpcJobLog.setHpcJobInfo(hpcJobInfo);
hpcJobLogService.update(hpcJobLog);
LOGGER.debug("HpcJobLog: id: " + hpcJobLog.getId());
HpcJobLogDetail hpcJobLogDetail = new HpcJobLogDetail();
hpcJobLogDetail.setAddedTime(new Date());
hpcJobLogDetail.setHpcJobLog(hpcJobLog);
// Pending
hpcJobLogDetail.setJobState(-1);
hpcJobLogDetail.setProgress("Pending");
hpcJobLogDetailService.add(hpcJobLogDetail);
LOGGER.debug("HpcJobLogDetail: id: " + hpcJobLogDetail.getId());
hpcGraphResultMap.put(hpcJobInfo, generalAlgorithmEditor);
// Put a new pre-process task into hpc job queue
HpcJobPreProcessTask preProcessTask = new HpcJobPreProcessTask(hpcJobInfo);
// Added a job to the pending list
final HpcAccount hpcAccount = hpcJobInfo.getHpcAccount();
Set<HpcJobInfo> hpcJobInfos = pendingHpcJobInfoMap.get(hpcAccount);
if (hpcJobInfos == null) {
hpcJobInfos = new LinkedHashSet<>();
}
hpcJobInfos.add(hpcJobInfo);
pendingHpcJobInfoMap.put(hpcAccount, hpcJobInfos);
executorService.execute(preProcessTask);
}
use of edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail in project tetrad by cmu-phil.
the class HpcJobManager method removeHpcJobInfoTransaction.
public synchronized void removeHpcJobInfoTransaction(final HpcJobInfo hpcJobInfo) {
HpcJobLog hpcJobLog = hpcJobLogService.findByHpcJobInfo(hpcJobInfo);
List<HpcJobLogDetail> logDetailList = hpcJobLogDetailService.findByHpcJobLog(hpcJobLog);
for (HpcJobLogDetail logDetail : logDetailList) {
hpcJobLogDetailService.remove(logDetail);
}
hpcJobLogService.remove(hpcJobLog);
}
Aggregations