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创建