Package com.taobao.zeus.store

Examples of com.taobao.zeus.store.HierarchyProperties


  public static JobContext getTempJobContext(){
    JobContext jobContext=new JobContext();
    JobHistory history=new JobHistory();
    jobContext.setJobHistory(history);
    jobContext.setWorkDir("/tmp");
    jobContext.setProperties(new HierarchyProperties(new HashMap<String, String>()));
    return jobContext;
  }
View Full Code Here


  public static void main(String[] args) {
    JobContext context=JobContext.getTempJobContext();
    Map<String, String> map=new HashMap<String, String>();
    map.put("hadoop.ugi.name", "uginame");
    HierarchyProperties properties=new HierarchyProperties(map);
    context.setProperties(properties);
   
    new MapReduceJob(context);
  }
View Full Code Here

      throws GwtException {
    try {
      TablePreviewModel result;
      String path = model.getPath();
      JobContext jobContext = JobContext.getTempJobContext();
      jobContext.setProperties(new HierarchyProperties(
          new HashMap<String, String>()));
      jobContext.getProperties().setProperty("preview.hdfs.path", path);
      jobContext.getProperties().setProperty("preview.hdfs.inputFormat",
          model.getInputFormat());
      jobContext.getProperties().setProperty("preview.hdfs.isCompressed",
View Full Code Here

  public static final Pattern PT = Pattern.compile("download\\[(doc|hdfs|http)://.+]");
 
  public static Job createDebugJob(JobContext jobContext,DebugHistory history,String workDir,ApplicationContext applicationContext){
    jobContext.setDebugHistory(history);
    jobContext.setWorkDir(workDir);
    HierarchyProperties hp=new HierarchyProperties(new HashMap<String, String>());
    String script =history.getScript();
    List<Map<String, String>> resources = new ArrayList<Map<String,String>>();
    // 处理脚本中的 资源引用 语句
    script = resolvScriptResource(resources, script, applicationContext);
    jobContext.setResources(resources);
    hp.setProperty(PropertyKeys.JOB_SCRIPT, script);
    FileManager fileManager=(FileManager) applicationContext.getBean("fileManager");
    ProfileManager profileManager=(ProfileManager) applicationContext.getBean("profileManager");
    String owner=fileManager.getFile(history.getFileId()).getOwner();
    Profile profile=profileManager.findByUid(owner);
    if(profile!=null && profile.getHadoopConf()!=null){
      for(String key:profile.getHadoopConf().keySet()){
        hp.setProperty(key, profile.getHadoopConf().get(key));
      }
    }
    jobContext.setProperties(new RenderHierarchyProperties(hp));
    hp.setProperty("hadoop.mapred.job.zeus_id", "zeus_debug_"+history.getId());
    List<Job> pres = new ArrayList<Job>(1);
    pres.add(new DownloadJob(jobContext));
    Job core = null;
    if(history.getJobRunType()==JobRunType.Hive){
      core =new HiveJob(jobContext,applicationContext);
View Full Code Here

 
  public static Job createJob(JobContext jobContext,JobBean jobBean,JobHistory history,String workDir,
      ApplicationContext applicationContext){
    jobContext.setJobHistory(history);
    jobContext.setWorkDir(workDir);
    HierarchyProperties hp=jobBean.getHierarchyProperties();
    if(history.getProperties()!=null && !history.getProperties().isEmpty()){
      history.getLog().appendZeus("This job hava instance configs:");
      for(String key:history.getProperties().keySet()){
        hp.setProperty(key, history.getProperties().get(key));
        history.getLog().appendZeus(key+"="+history.getProperties().get(key));
      }
    }
    jobContext.setProperties(new RenderHierarchyProperties(hp));
    List<Map<String, String>> resources = jobBean.getHierarchyResources();
    String script = jobBean.getJobDescriptor().getScript();
    // 处理脚本中的 资源引用 语句
    if(jobBean.getJobDescriptor().getJobType().equals(JobRunType.Shell)
        ||jobBean.getJobDescriptor().getJobType().equals(JobRunType.Hive)){
      script = resolvScriptResource(resources, script, applicationContext);
      jobBean.getJobDescriptor().setScript(script);
    }
    jobContext.setResources(resources);
    script=replace(jobContext.getProperties().getAllProperties(), script);
    hp.setProperty(PropertyKeys.JOB_SCRIPT, script);
   
    //添加宙斯标记属性,提供给云梯
    hp.setProperty("hadoop.mapred.job.zues_id", "zeus_job_"+history.getJobId()+"_"+history.getId());
   
    //前置处理Job创建
    List<Job> pres=parseJobs(jobContext, applicationContext, jobBean,jobBean.getJobDescriptor().getPreProcessers(),history,workDir);
    pres.add(0, new DownloadJob(jobContext));
    //后置处理Job创建
View Full Code Here

       
        JobHistory history=new JobHistory();
        JobContext jobContext=new JobContext();
        jobContext.setWorkDir(temp.getParent());
        jobContext.setJobHistory(history);
        jobContext.setProperties(new HierarchyProperties(new HashMap<String, String>()));
        UploadHdfsFileJob job=new UploadHdfsFileJob(jobContext, temp.getAbsolutePath(), hdfsLibPath);
        Integer exitCode=job.run();
        if(exitCode!=0){
          log.error(history.getLog().getContent());
          resp.getWriter().write(history.getLog().getContent());
View Full Code Here

TOP

Related Classes of com.taobao.zeus.store.HierarchyProperties

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.