Search in sources :

Example 1 with ConsoleJobInfoVO

use of com.dtstack.taier.develop.vo.console.ConsoleJobInfoVO in project Taier by DTStack.

the class ConsoleService method searchJob.

public ConsoleJobVO searchJob(String jobName) {
    String jobId = null;
    ScheduleJob scheduleJob = scheduleJobMapper.getByName(jobName);
    if (scheduleJob != null) {
        jobId = scheduleJob.getJobId();
    }
    if (jobId == null) {
        return null;
    }
    ScheduleEngineJobCache engineJobCache = scheduleEngineJobCacheMapper.getOne(jobId);
    if (engineJobCache == null) {
        return null;
    }
    try {
        ParamAction paramAction = PublicUtil.jsonStrToObject(engineJobCache.getJobInfo(), ParamAction.class);
        Tenant tenant = tenantMapper.selectById(scheduleJob.getTenantId());
        ConsoleJobInfoVO consoleJobInfoVO = this.fillJobInfo(paramAction, scheduleJob, engineJobCache, tenant);
        ConsoleJobVO vo = new ConsoleJobVO();
        vo.setTheJob(consoleJobInfoVO);
        vo.setNodeAddress(engineJobCache.getNodeAddress());
        vo.setTheJobIdx(1);
        return vo;
    } catch (Exception e) {
        LOGGER.error("searchJob error:", e);
    }
    return null;
}
Also used : ParamAction(com.dtstack.taier.pluginapi.pojo.ParamAction) ConsoleJobVO(com.dtstack.taier.develop.vo.console.ConsoleJobVO) ConsoleJobInfoVO(com.dtstack.taier.develop.vo.console.ConsoleJobInfoVO) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException)

Example 2 with ConsoleJobInfoVO

use of com.dtstack.taier.develop.vo.console.ConsoleJobInfoVO in project Taier by DTStack.

the class ConsoleService method fillJobInfo.

private ConsoleJobInfoVO fillJobInfo(ParamAction paramAction, ScheduleJob scheduleJob, ScheduleEngineJobCache engineJobCache, Tenant tenant) {
    ConsoleJobInfoVO infoVO = new ConsoleJobInfoVO();
    infoVO.setStatus(scheduleJob.getStatus());
    infoVO.setExecStartTime(scheduleJob.getExecStartTime());
    infoVO.setGenerateTime(engineJobCache.getGmtCreate());
    long currentTime = System.currentTimeMillis();
    String waitTime = DateUtil.getTimeDifference(currentTime - engineJobCache.getGmtCreate().getTime());
    infoVO.setWaitTime(waitTime);
    infoVO.setTenantName(null == tenant ? "" : tenant.getTenantName());
    infoVO.setParamAction(paramAction);
    return infoVO;
}
Also used : ConsoleJobInfoVO(com.dtstack.taier.develop.vo.console.ConsoleJobInfoVO)

Aggregations

ConsoleJobInfoVO (com.dtstack.taier.develop.vo.console.ConsoleJobInfoVO)2 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 ConsoleJobVO (com.dtstack.taier.develop.vo.console.ConsoleJobVO)1 ParamAction (com.dtstack.taier.pluginapi.pojo.ParamAction)1