Search in sources :

Example 1 with HpcJobLogDetail

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);
}
Also used : HpcJobLogDetail(edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail) Date(java.util.Date)

Example 2 with 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);
}
Also used : HpcJobPreProcessTask(edu.cmu.tetradapp.app.hpc.task.HpcJobPreProcessTask) HpcAccount(edu.pitt.dbmi.tetrad.db.entity.HpcAccount) HpcJobInfo(edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo) HpcJobLogDetail(edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail) HpcJobLog(edu.pitt.dbmi.tetrad.db.entity.HpcJobLog) Date(java.util.Date)

Example 3 with HpcJobLogDetail

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);
}
Also used : HpcJobLogDetail(edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail) HpcJobLog(edu.pitt.dbmi.tetrad.db.entity.HpcJobLog)

Aggregations

HpcJobLogDetail (edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail)3 HpcJobLog (edu.pitt.dbmi.tetrad.db.entity.HpcJobLog)2 Date (java.util.Date)2 HpcJobPreProcessTask (edu.cmu.tetradapp.app.hpc.task.HpcJobPreProcessTask)1 HpcAccount (edu.pitt.dbmi.tetrad.db.entity.HpcAccount)1 HpcJobInfo (edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo)1