Examples of JobBean


Examples of com.taobao.zeus.store.JobBean

        if(chainLocal.get()==null || !chainLocal.get().getCauseJobId().equals(causeJobId)){
          GroupBean gb=readOnlyGroupManager.getGlobeGroupBean();
          chainLocal.set(new ChainException(causeJobId, gb));
        }
        final ChainException chain=chainLocal.get();
        final JobBean jobBean=chain.gb.getAllSubJobBeans().get(jobId);
        final ZeusUser owner=userManager.findByUid(jobBean.getJobDescriptor().getOwner());
        //延迟6秒发送邮件,保证日志已经输出到数据库
        new Thread(){
          public void run() {
            try {
              Thread.sleep(6000);
              StringBuffer sb=new StringBuffer();
              sb.append("Job任务(").append(jobId).append(")").append(jobBean.getJobDescriptor().getName()).append("运行失败");
              sb.append("<br/>");
              String type="";
              if(event.getTriggerType()==TriggerType.MANUAL){
                type="手动触发";
              }else if(event.getTriggerType()==TriggerType.MANUAL_RECOVER){
                type="手动恢复";
              }else if(event.getTriggerType()==TriggerType.SCHEDULE){
                type="自动调度";
              }
              sb.append("Job任务的触发类型为:"+type).append("<br/>");
              if(event.getHistory()!=null){
                sb.append("失败原因:"+jobHistoryManager.findJobHistory(event.getHistory().getId()).getLog().getContent().replaceAll("\\n", "<br/>"));
                String msg= "Zeus报警 JobId:"+jobId+" 任务运行失败";
                if(!jobBean.getDepender().isEmpty()){
                  msg+=",影响范围:"+getDependencyJobs(jobBean);
                }
                if(!causeJobId.equalsIgnoreCase(event.getJobId())){
                  msg+="(根本原因:job "+causeJobId+"运行失败)";
                }
                mailAlarm.alarm(event.getHistory().getId(), msg, sb.toString());
              }
            } catch (Exception e) {
              log.error("邮件发送出现异常",e);
            }
          };
        }.start();
       
        String msg="Job任务("+jobId+"-"+owner.getName()+"):"+jobBean.getJobDescriptor().getName()+" 运行失败";
        if(!jobBean.getDepender().isEmpty()){
          msg+=",影响范围:"+getDependencyJobs(jobBean);
        }
        if(!causeJobId.equalsIgnoreCase(event.getJobId())){
          msg+="(根本原因:job "+causeJobId+"运行失败)";
        }
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

      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());
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

   * @return
   */
  private boolean isAllJobsNotChangeParent(GroupBean gb,List<JobDescriptor> list){
    Map<String, JobBean> allJobs=gb.getAllSubJobBeans();
    for(JobDescriptor jd:list){
      JobBean bean=allJobs.get(jd.getId());
      if(bean==null){
        DebugInfoLog.info("isAllJobsNotChangeParent job id="+ jd.getId()+" has changed");
        return false;
      }
      JobDescriptor old=bean.getJobDescriptor();
      if(!old.getGroupId().equals(jd.getGroupId())){
        DebugInfoLog.info("isAllJobsNotChangeParent job id="+ jd.getId()+" has changed");
        return false;
      }
    }
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

                + File.separator + date + File.separator
                + "manual-" + history.getId());
            if (!direcotry.exists()) {
              direcotry.mkdirs();
            }
            JobBean jb = context.getGroupManager()
                .getUpstreamJobBean(history.getJobId());

            final Job job = JobUtils.createJob(new JobContext(JobContext.MANUAL_RUN),
                jb, history, direcotry.getAbsolutePath(),
                context.getApplicationContext());
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

            history.setExecuteHost(WorkerContext.host);
            history.setStartTime(new Date());
            context.getJobHistoryManager()
                .updateJobHistory(history);

            JobBean jb = context.getGroupManager()
                .getUpstreamJobBean(history.getJobId());
            String date = new SimpleDateFormat("yyyy-MM-dd")
                .format(new Date());
            File direcotry = new File(Environment.getDownloadPath()
                + File.separator + date + File.separator
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

  public GroupJobTreeModel getMyTreeData() {
    String uid=LoginUser.getUser().getUid();
    GroupBean rootGroup=readOnlyGroupManager.getGlobeGroupBeanForTreeDisplay(true);
    Map<String, JobBean> allJobs=rootGroup.getAllSubJobBeans();
    for(String key:allJobs.keySet()){
      JobBean bean=allJobs.get(key);
      //不是owner,删除
      if(!bean.getJobDescriptor().getOwner().equals(uid)){
        bean.getGroupBean().getJobBeans().remove(key);
      }
    }
   
    Map<String, GroupBean> allGroups=rootGroup.getAllSubGroupBeans();
    List<GroupBean> leafGroups=new ArrayList<GroupBean>();
    for(GroupBean bean:allGroups.values()){
      if(!bean.isDirectory() || bean.getChildrenGroupBeans().isEmpty()){
        leafGroups.add(bean);
      }
    }
    for(GroupBean bean:leafGroups){
      recursionRemove(bean, uid);
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

  }

  @Override
  public GroupJobTreeModel getDependeeTree(String jobId) {
    GroupBean globe=readOnlyGroupManager.getGlobeGroupBean();
    JobBean jb=globe.getAllSubJobBeans().get(jobId);
    if(jb!=null){
      GroupJobTreeModel root=new GroupJobTreeModel();
      root.setName(jb.getJobDescriptor().getName());
      root.setId(jb.getJobDescriptor().getId());
      root.setGroup(false);
      root.setDirectory(jb.getDependee().isEmpty()?false:true);
      root.setJob(true);
      root.setOwner(jb.getJobDescriptor().getOwner());
     
      setJob(root,jb.getDependee(),true);
      return root;
    }
    return null;
  }
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

  }

  @Override
  public GroupJobTreeModel getDependerTree(String jobId) {
    GroupBean globe=readOnlyGroupManager.getGlobeGroupBean();
    JobBean jb=globe.getAllSubJobBeans().get(jobId);
    if(jb!=null){
      GroupJobTreeModel root=new GroupJobTreeModel();
      root.setName(jb.getJobDescriptor().getName());
      root.setId(jb.getJobDescriptor().getId());
      root.setGroup(false);
      root.setDirectory(jb.getDepender().isEmpty()?false:true);
      root.setJob(true);
      root.setOwner(jb.getJobDescriptor().getOwner());
     
      setJob(root,jb.getDepender(),false);
      return root;
    }
    return null;
  }
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

  }
  private Boolean isGroupOwner(String uid,String groupId){
    return isGroupOwner(uid, groupManager.getUpstreamGroupBean(groupId));
  }
  private Boolean isJobOwner(String uid,String jobId){
    JobBean jb=groupManager.getUpstreamJobBean(jobId);
    if(jb.getJobDescriptor().getOwner().equalsIgnoreCase(uid)){
      return true;
    }
    return isGroupOwner(uid, jb.getGroupBean());
  }
View Full Code Here

Examples of com.taobao.zeus.store.JobBean

      throw new ZeusException("您无权操作");
    }
  }
  @Override
  public void grantJobOwner(String granter, String uid, String jobId) throws ZeusException{
    JobBean jb=groupManager.getUpstreamJobBean(jobId);
    List<String> owners=new ArrayList<String>();
    owners.add(jb.getJobDescriptor().getOwner());
    GroupBean gb=jb.getGroupBean();
    while(gb!=null){
      if(!owners.contains(gb.getGroupDescriptor().getOwner())){
        owners.add(gb.getGroupDescriptor().getOwner());
      }
      gb=gb.getParentGroupBean();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.