Examples of JobDescriptor


Examples of com.taobao.zeus.model.JobDescriptor

    }
    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");
        model.setLastStatus(format.format(his.getStartTime())+" "+(his.getStatus()==null?"":his.getStatus().getId()));
      }
      result.add(model);
View Full Code Here

Examples of com.taobao.zeus.model.JobDescriptor

      throw new GwtException(e.getMessage());
    }
  }
  @Override
  public void syncScript(String jobId, String script) throws GwtException {
    JobDescriptor jd=permissionGroupManager.getJobDescriptor(jobId).getX();
    jd.setScript(script);
    try {
      permissionGroupManager.updateJob(LoginUser.getUser().getUid(), jd);
    } catch (ZeusException e) {
      log.error("syncScript",e);
      throw new GwtException("同步失败,可能是因为目标任务没有配置一些必填项。请去调度中心配置完整的必填项. cause:"+e.getMessage());
View Full Code Here

Examples of com.taobao.zeus.model.JobDescriptor

  }

  @Override
  public JobDescriptor createJob(String user, String jobName,
      String parentGroup, JobRunType jobType) throws ZeusException {
    JobDescriptor jd=groupManager.createJob(user, jobName, parentGroup, jobType);
    try {
      worker.updateJobFromWeb(jd.getId());
    } catch (Exception e) {
      String msg="创建Job成功,但是调度Job失败";
      log.error(msg,e);
      throw new ZeusException(msg,e);
    }
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

                    }
                } else if ("ntype".equals(header))
                    Node.setNtype(value);
                else if ("jobs".equals(header)) {
                    String[] jobs = value.split(", ");
                    JobDescriptor jo;
                    //Job[] Jobs = new Job[jobs.length];
                    for (String job : jobs) {
                        String[] c = job.split("/");
                        String Jid = c[1];
                        jo = this.getJobDescriptorById(Jid);
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

        StandardOutReader stdOutReader = new StandardOutReader();
        CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);

        String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !");;
        String[] info = result.split("\n");
        JobDescriptor jobDescriptor = new JobDescriptor();
        String[] line;
        for (int i = 0; i < info.length; i++) {
            if (info[i].contains("=")) {
                line = info[i].split("=", 2);
            } else {
                line = info[i].split(":", 2);
            }
            if (line.length >= 2) {
                String header = line[0].trim();
                log.debug("Header = " + header);
                String value = line[1].trim();
                log.debug("value = " + value);

                if (header.equals("Variable_List")) {
                    while (info[i + 1].startsWith("\t")) {
                        value += info[i + 1];
                        i++;
                    }
                    value = value.replaceAll("\t", "");
                    jobDescriptor.setVariableList(value);
                } else if ("Job Id".equals(header)) {
                    jobDescriptor.setJobID(value);
                } else if ("Job_Name".equals(header)) {
                    jobDescriptor.setJobName(value);
                } else if ("Account_Name".equals(header)) {
                    jobDescriptor.setAcountString(value);
                } else if ("job_state".equals(header)) {
                    jobDescriptor.setStatus(value);
                } else if ("Job_Owner".equals(header)) {
                    jobDescriptor.setOwner(value);
                } else if ("resources_used.cput".equals(header)) {
                    jobDescriptor.setUsedCPUTime(value);
                } else if ("resources_used.mem".equals(header)) {
                    jobDescriptor.setUsedMemory(value);
                } else if ("resources_used.walltime".equals(header)) {
                    jobDescriptor.setEllapsedTime(value);
                } else if ("job_state".equals(header)) {
                    jobDescriptor.setStatus(value);
                } else if ("queue".equals(header))
                    jobDescriptor.setQueueName(value);
                else if ("ctime".equals(header)) {
                    jobDescriptor.setCTime(value);
                } else if ("qtime".equals(header)) {
                    jobDescriptor.setQTime(value);
                } else if ("mtime".equals(header)) {
                    jobDescriptor.setMTime(value);
                } else if ("start_time".equals(header)) {
                    jobDescriptor.setSTime(value);
                } else if ("comp_time".equals(header)) {
                    jobDescriptor.setCompTime(value);
                } else if ("exec_host".equals(header)) {
                    jobDescriptor.setExecuteNode(value);
                } else if ("Output_Path".equals(header)) {
                    if (info[i + 1].contains("=") || info[i + 1].contains(":"))
                        jobDescriptor.setStandardOutFile(value);
                    else {
                        jobDescriptor.setStandardOutFile(value + info[i + 1].trim());
                        i++;
                    }
                } else if ("Error_Path".equals(header)) {
                    if (info[i + 1].contains("=") || info[i + 1].contains(":"))
                        jobDescriptor.setStandardErrorFile(value);
                    else {
                        String st = info[i + 1].trim();
                        jobDescriptor.setStandardErrorFile(value + st);
                        i++;
                    }

                } else if ("submit_args".equals(header)) {
                    while (i + 1 < info.length) {
                        if (info[i + 1].startsWith("\t")) {
                            value += info[i + 1];
                            i++;
                        } else
                            break;
                    }
                    value = value.replaceAll("\t", "");
                    jobDescriptor.setSubmitArgs(value);
                }
            }
        }
        return jobDescriptor;
    }
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

        StandardOutReader stdOutReader = new StandardOutReader();
        CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);

        getOutputifAvailable(stdOutReader, "Error cancelling job with Job ID : " + jobID);

        JobDescriptor jobById = this.getJobDescriptorById(jobID);
        if (CommonUtils.isJobFinished(jobById)) {
            log.debug("Job Cancel operation was successful !");
            return jobById;
        } else {
            log.debug("Job Cancel operation was not successful !");
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

        StandardOutReader stdOutReader = new StandardOutReader();
        CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
        String outputifAvailable = getOutputifAvailable(stdOutReader, "Error reading output of job submission");
        // this might not be the case for all teh resources, if so Cluster implementation can override this method
        // because here after cancelling we try to get the job description and return it back
        JobDescriptor jobById = this.getJobDescriptorById(jobID);
        if (CommonUtils.isJobFinished(jobById)) {
            log.debug("Job Cancel operation was successful !");
            return jobById;
        } else {
            log.debug("Job Cancel operation was not successful !");
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

    public JobDescriptor getJobDescriptorById(String jobID) throws SSHApiException {
        RawCommandInfo rawCommandInfo = jobManagerConfiguration.getMonitorCommand(jobID);
        StandardOutReader stdOutReader = new StandardOutReader();
        CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
        String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !");
        JobDescriptor jobDescriptor = new JobDescriptor();
        jobManagerConfiguration.getParser().parse(jobDescriptor,result);
        return jobDescriptor;
    }
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

                throw new GFacProviderException("Security context is not set properly");
            } else {
                log.info("Successfully retrieved the Security Context");
            }
            // This installed path is a mandetory field, because this could change based on the computing resource
            JobDescriptor jobDescriptor = GFACGSISSHUtils.createJobDescriptor(jobExecutionContext, app, cluster);

            log.info(jobDescriptor.toXML());
            data.append("jobDesc=").append(jobDescriptor.toXML());
            jobDetails.setJobDescription(jobDescriptor.toXML());

            String jobID = cluster.submitBatchJob(jobDescriptor);
            jobExecutionContext.setJobDetails(jobDetails);
            if (jobID == null) {
                jobDetails.setJobID("none");
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.api.job.JobDescriptor

        }
    }

    public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext,
                                                    ApplicationDeploymentDescriptionType app, Cluster cluster) {
        JobDescriptor jobDescriptor = new JobDescriptor();
        // this is common for any application descriptor
        jobDescriptor.setInputDirectory(app.getInputDataDirectory());
        jobDescriptor.setOutputDirectory(app.getOutputDataDirectory());
        jobDescriptor.setExecutablePath(app.getExecutableLocation());
        jobDescriptor.setStandardOutFile(app.getStandardOutput());
        jobDescriptor.setStandardErrorFile(app.getStandardError());
        Random random = new Random();
        int i = random.nextInt();
        jobDescriptor.setJobName(app.getApplicationName().getStringValue() + String.valueOf(i));
        jobDescriptor.setWorkingDirectory(app.getStaticWorkingDirectory());

        List<String> inputValues = new ArrayList<String>();
        MessageContext input = jobExecutionContext.getInMessageContext();
        Map<String, Object> inputs = input.getParameters();
        Set<String> keys = inputs.keySet();
        for (String paramName : keys) {
            ActualParameter actualParameter = (ActualParameter) inputs.get(paramName);
            if ("URIArray".equals(actualParameter.getType().getType().toString()) || "StringArray".equals(actualParameter.getType().getType().toString())
                    || "FileArray".equals(actualParameter.getType().getType().toString())) {
                String[] values = null;
                if (actualParameter.getType() instanceof URIArrayType) {
                    values = ((URIArrayType) actualParameter.getType()).getValueArray();
                } else if (actualParameter.getType() instanceof StringArrayType) {
                    values = ((StringArrayType) actualParameter.getType()).getValueArray();
                } else if (actualParameter.getType() instanceof FileArrayType) {
                    values = ((FileArrayType) actualParameter.getType()).getValueArray();
                }
                String value = StringUtil.createDelimiteredString(values, " ");
                inputValues.add(value);
            } else {
                String paramValue = MappingFactory.toString(actualParameter);
                inputValues.add(paramValue);
            }
        }
        jobDescriptor.setInputValues(inputValues);

        // this part will fill out the hpcApplicationDescriptor
        if (app instanceof HpcApplicationDeploymentType) {
            HpcApplicationDeploymentType applicationDeploymentType
                    = (HpcApplicationDeploymentType) app;
            jobDescriptor.setShellName("/bin/bash");
            jobDescriptor.setAllEnvExport(true);
            jobDescriptor.setMailOptions("n");
            jobDescriptor.setNodes(applicationDeploymentType.getNodeCount());
            jobDescriptor.setProcessesPerNode(applicationDeploymentType.getProcessorsPerNode());
            jobDescriptor.setMaxWallTime(String.valueOf(applicationDeploymentType.getMaxWallTime()));
            jobDescriptor.setJobSubmitter(applicationDeploymentType.getJobSubmitterCommand());
            jobDescriptor.setCPUCount(applicationDeploymentType.getCpuCount());
            if (applicationDeploymentType.getProjectAccount() != null) {
                if (applicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null) {
                    jobDescriptor.setAcountString(applicationDeploymentType.getProjectAccount().getProjectAccountNumber());
                }
            }
            if (applicationDeploymentType.getQueue() != null) {
                if (applicationDeploymentType.getQueue().getQueueName() != null) {
                    jobDescriptor.setQueueName(applicationDeploymentType.getQueue().getQueueName());
                }
            }
            jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
            TaskDetails taskData = jobExecutionContext.getTaskData();
            if (taskData != null && taskData.isSetTaskScheduling()) {
                ComputationalResourceScheduling computionnalResource = taskData.getTaskScheduling();
                if (computionnalResource.getNodeCount() > 0) {
                    jobDescriptor.setNodes(computionnalResource.getNodeCount());
                }
                if (computionnalResource.getComputationalProjectAccount() != null) {
                    jobDescriptor.setAcountString(computionnalResource.getComputationalProjectAccount());
                }
                if (computionnalResource.getQueueName() != null) {
                    jobDescriptor.setQueueName(computionnalResource.getQueueName());
                }
                if (computionnalResource.getTotalCPUCount() > 0) {
                    jobDescriptor.setProcessesPerNode(computionnalResource.getTotalCPUCount());
                }
                if (computionnalResource.getWallTimeLimit() > 0) {
                    jobDescriptor.setMaxWallTime(String.valueOf(computionnalResource.getWallTimeLimit()));
                }
            }

        }
        return jobDescriptor;
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.