Package com.taobao.zeus.model

Examples of com.taobao.zeus.model.JobStatus


          ScheduleInfoLog.error(
              String.format("JobId:%s run failed", jobId), e);
        }
        boolean success = resp.getStatus() == Status.OK ? true : false;

        JobStatus jobstatus = context.getGroupManager().getJobStatus(
            jobId);
        jobstatus
            .setStatus(com.taobao.zeus.model.JobStatus.Status.WAIT);
        if (success
            && (his.getTriggerType() == TriggerType.SCHEDULE || his
                .getTriggerType() == TriggerType.MANUAL_RECOVER)) {
          ScheduleInfoLog.info("JobId:" + jobId
              + " clear ready dependency");
          jobstatus.setReadyDependency(new HashMap<String, String>());
        }
        context.getGroupManager().updateJobStatus(jobstatus);

        if (!success) {
          // 运行失败,更新失败状态,发出失败消息
View Full Code Here


      final List<JobHistory> hiss = new ArrayList<JobHistory>();
      Map<String, Tuple<JobDescriptor, JobStatus>> map = context
          .getGroupManager().getJobDescriptor(
              holder.getRunnings().keySet());
      for (String key : map.keySet()) {
        JobStatus js = map.get(key).getY();
        if (js.getHistoryId() != null) {
          hiss.add(context.getJobHistoryManager().findJobHistory(
              js.getHistoryId()));
        }
        js.setStatus(com.taobao.zeus.model.JobStatus.Status.FAILED);
        context.getGroupManager().updateJobStatus(js);
      }
      new Thread() {
        @Override
        public void run() {
View Full Code Here

      context.getJobHistoryManager().updateJobHistoryLog(history.getId(),
          history.getLog().getContent());
      if (history.getTriggerType() == TriggerType.MANUAL) {
        context.getManualQueue().offer(history.getId());
      } else {
        JobStatus js = context.getGroupManager().getJobStatus(
            history.getJobId());
        js.setStatus(com.taobao.zeus.model.JobStatus.Status.RUNNING);
        js.setHistoryId(history.getId());
        context.getGroupManager().updateJobStatus(js);
        context.getQueue().offer(jobId);
      }
    }
    context.getJobHistoryManager().updateJobHistory(history);
View Full Code Here

      }
    }

    if (ret == null) {
      // 数据库设置状态
      JobStatus js = context.getGroupManager().getJobStatus(jobId);
      js.setStatus(com.taobao.zeus.model.JobStatus.Status.WAIT);
      js.setHistoryId(null);
      context.getGroupManager().updateJobStatus(js);
      // 找不到job,失败
      ret = WebResponse.newBuilder().setRid(req.getRid())
          .setOperate(req.getOperate()).setStatus(Status.ERROR)
          .setErrorText("Schedule任务中找不到匹配的job("+history.getJobId()+","+history.getId()+"),无法执行取消命令").build();
View Full Code Here

      }
      jd.setPostProcessers(postProcessers);
    }
   
   
    JobStatus status=new JobStatus();
    status.setJobId(String.valueOf(persist.getId()));
    status.setStatus(Status.parser(persist.getStatus()));
    status.setHistoryId(persist.getHistoryId()==null?null:persist.getHistoryId().toString());
    status.setReadyDependency(new HashMap<String, String>());
    if(persist.getReadyDependency()!=null){
      JSONObject o=JSONObject.fromObject(persist.getReadyDependency());
      for(Object key:o.keySet()){
        status.getReadyDependency().put(key.toString(), o.getString(key.toString()));
      }
    }
    return new Tuple<JobDescriptor, JobStatus>(jd, status);
  }
View Full Code Here

      ScheduleInfoLog.error("JobId:"+jobId+" handleEvent error", e);
    }
  }
 
  private void initializeEventHandle(){
    JobStatus jobStatus=groupManager.getJobStatus(jobId);
    if(jobStatus!=null){
      //启动时发现在RUNNING 状态,说明上一次运行的结果丢失,将立即进行重试
      if(jobStatus.getStatus()==Status.RUNNING){
        log.error("jobId="+jobId+" 处于RUNNING状态,说明该JOB状态丢失,立即进行重试操作...");
        //搜索上一次运行的日志,从日志中提取jobid 进行kill
        String operator=null;
        if(jobStatus.getHistoryId()!=null){
          JobHistory history=jobHistoryManager.findJobHistory(jobStatus.getHistoryId());
          operator=history.getOperator();
          if(history.getStatus()==Status.RUNNING){
            try {
              JobContext temp=JobContext.getTempJobContext();
              temp.setJobHistory(history);
View Full Code Here

      return ;
    }
    if(!jobDescriptor.getDependencies().contains(eId) ){
      return ;
    }
    JobStatus jobStatus=null;
    synchronized (this) {
      jobStatus=groupManager.getJobStatus(jobId);
      JobBean bean=groupManager.getUpstreamJobBean(jobId);
      String cycle=bean.getHierarchyProperties().getProperty(PropertyKeys.DEPENDENCY_CYCLE);
      if(cycle!=null && !"".equals(cycle)){
        Map<String, String> dep=jobStatus.getReadyDependency();
        if("sameday".equals(cycle)){
          SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
          String now=format.format(new Date());
          for(String key:new HashSet<String>(dep.keySet())){
            String d=format.format(new Date(Long.valueOf(dep.get(key))));
            if(!now.equals(d)){
              jobStatus.getReadyDependency().remove(key);
              ScheduleInfoLog.info("JobId:"+jobId+" remove overdue dependency "+key);
            }
          }
        }
      }
     
      ScheduleInfoLog.info("JobId:"+jobId+" received a successed dependency job with jobId:"+event.getJobId());
     
      ScheduleInfoLog.info("JobId:"+jobId+" the dependency jobId:"+event.getJobId()+" record it");
      jobStatus.getReadyDependency().put(eId, String.valueOf(new Date().getTime()));
     
      groupManager.updateJobStatus(jobStatus);
    }
    boolean allComplete=true;
    for(String key:jobDescriptor.getDependencies()){
      if(jobStatus.getReadyDependency().get(key)==null){
        allComplete=false;
        break;
      }
    }
    if(allComplete){
View Full Code Here

              .setOperate(Operate.Schedule).setStatus(
                  Status.ERROR).build();
        }
      });
    }
    final JobStatus js = context.getGroupManager().getJobStatus(jobId);
    final JobHistory history = context.getJobHistoryManager()
        .findJobHistory(js.getHistoryId());
    Future<Response> f = context.getThreadPool().submit(
        new Callable<Response>() {
          public Response call() throws Exception {
            history.setExecuteHost(WorkerContext.host);
            history.setStartTime(new Date());
View Full Code Here

   
    return new PagingLoadResultBean<JobHistoryModel>(data,total,config.getOffset());
  }
  @Override
  public JobModel getJobStatus(String jobId) {
    JobStatus jobStatus=permissionGroupManager.getJobStatus(jobId);
    if(jobStatus==null){
      return null;
    }
    JobModel model=new JobModel();
    model.setId(jobStatus.getJobId());
    model.setReadyDependencies(jobStatus.getReadyDependency());
    model.setStatus(jobStatus.getStatus()==null?"":jobStatus.getStatus().getId());
    return model;
  }
View Full Code Here

      jobIds.add(tuple.getX().getId());
    }
    Map<String,JobHistory> jobHisMap=jobHistoryManager.findLastHistoryByList(jobIds);
    List<JobModel> result=new ArrayList<JobModel>();
    for(Tuple<JobDescriptor, JobStatus> job:allJobs){
      JobStatus status=job.getY();
      JobDescriptor jd=job.getX();
      JobModel model=new JobModel();
      model.setId(status.getJobId());
      Map<String, String> dep=new HashMap<String, String>();
      for(String jobId:job.getX().getDependencies()){
        if(jobId!=null && !"".equals(jobId)){
          dep.put(jobId, null);
        }
      }
      dep.putAll(status.getReadyDependency());
      model.setReadyDependencies(dep);
      model.setStatus(status.getStatus()==null?null:status.getStatus().getId());
      model.setName(jd.getName());
      model.setAuto(jd.getAuto());
      JobHistory his=jobHisMap.get(jd.getId());
      if(his!=null && his.getStartTime()!=null){
        SimpleDateFormat format=new SimpleDateFormat("MM-dd HH:mm:ss");
View Full Code Here

TOP

Related Classes of com.taobao.zeus.model.JobStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.