Package org.apache.airavata.schemas.gfac

Examples of org.apache.airavata.schemas.gfac.HostDescriptionType


                            ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp()
                                    .getType();
                            srcFilePath = app.getOutputDataDirectory() + File.separator + srcFilePath;

                            HostDescriptionType hostDescription = context.getExecutionDescription().getHost().getType();
                            if (hostDescription instanceof GlobusHostType) {
                                gridFTPTransfer(context, uri, srcFilePath);
                            } else if (GfacUtils.isLocalHost(hostDescription.getHostAddress())) {
                                updateFile(context, uri, srcFilePath);
                            }
                        }
                    }
                }
View Full Code Here


                            String destFilePath = file.getName();

                            ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp().getType();
                            destFilePath = app.getInputDataDirectory() + File.separator + destFilePath;

                            HostDescriptionType hostDescription = context.getExecutionDescription().getHost().getType();
                            if (hostDescription instanceof GlobusHostType) {
                                uploadToGridFTPFromHttp(context, uri, destFilePath);
                            } else {
                                downloadFile(context, uri, destFilePath);
                            }
View Full Code Here

                            String destFilePath = file.getName();

                            ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp().getType();
                            destFilePath = app.getInputDataDirectory() + File.separator + destFilePath;

                            HostDescriptionType hostDescription = context.getExecutionDescription().getHost().getType();
                            if (hostDescription instanceof GlobusHostType) {
                                gridFTPTransfer(context, uri, destFilePath);
                            } else if (GfacUtils.isLocalHost(hostDescription.getHostAddress())) {
                                downloadFile(context, uri, destFilePath);
                            }

                            /*
                             * Replace parameter
View Full Code Here

      }
    }
    return result;
  }
    private void loadData() {
      HostDescriptionType t = getOriginalHostDescription().getType();
      hostIdTextField.setText(t.getHostName());
    hostAddressTextField.setText(t.getHostAddress());
    boolean isGlobus = t instanceof GlobusHostType;
    chkGobusHost.setSelected(isGlobus);
    if (isGlobus){
      globusGateKeeperTextField.setText(arrayToString(((GlobusHostType) t).getGlobusGateKeeperEndPointArray()));
      GridFTPTextField.setText(arrayToString(((GlobusHostType) t).getGridFTPEndPointArray()));
View Full Code Here

    }

    public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
        log.info("Invoking GSISSH Provider Invoke ...");
        jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
        HostDescriptionType host = jobExecutionContext.getApplicationContext().
                getHostDescription().getType();
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
                getApplicationDeploymentDescription().getType();
        try {
            Cluster cluster = null;
            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) != null) {
                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
            } else {
                cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
            }
            if (cluster == null) {
                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 = new JobDescriptor();
            jobDescriptor.setWorkingDirectory(app.getStaticWorkingDirectory());
            jobDescriptor.setShellName("/bin/bash");
            Random random = new Random();
            int i = random.nextInt();
            jobDescriptor.setJobName(app.getApplicationName().getStringValue() + String.valueOf(i));
            jobDescriptor.setExecutablePath(app.getExecutableLocation());
            jobDescriptor.setAllEnvExport(true);
            jobDescriptor.setMailOptions("n");
            jobDescriptor.setStandardOutFile(app.getStandardOutput());
            jobDescriptor.setStandardErrorFile(app.getStandardError());
            jobDescriptor.setNodes(app.getNodeCount());
            jobDescriptor.setProcessesPerNode(app.getProcessorsPerNode());
            jobDescriptor.setMaxWallTime(String.valueOf(app.getMaxWallTime()));
            jobDescriptor.setJobSubmitter(app.getJobSubmitterCommand());
            if (app.getProjectAccount().getProjectAccountNumber() != null) {
                jobDescriptor.setAcountString(app.getProjectAccount().getProjectAccountNumber());
            }
            if (app.getQueue().getQueueName() != null) {
                jobDescriptor.setQueueName(app.getQueue().getQueueName());
            }
            jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
            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);

            log.info(jobDescriptor.toXML());
            final String jobID = cluster.submitBatchJob(jobDescriptor);
            log.info("Job Submitted successfully and returned Job ID: " + jobID);
            jobExecutionContext.getNotifier().publish(new JobIDEvent(jobID));

            final JobSubmissionListener listener = new GSISSHJobSubmissionListener(jobExecutionContext);
            final Cluster finalCluster = cluster;
//            try {
//            // Wait 5 seconds to start the first poll, this is hard coded, user doesn't have
//            // to configure this.
//            Thread.sleep(5000);
//        } catch (InterruptedException e) {
//            log.error("Error during job status monitoring");
//            throw new SSHApiException("Error during job status monitoring", e);
//        }
//        // Get the job status first
            try {
//
                Thread t = new Thread() {
                    @Override
                    public void run() {
                        try {
                            JobStatus jobStatus = finalCluster.getJobStatus(jobID);
                            listener.statusChanged(jobStatus);
                            while (true) {
                                while (!jobStatus.equals(JobStatus.C)) {
                                    if (!jobStatus.equals(listener.getJobStatus().toString())) {
                                        listener.setJobStatus(jobStatus);
                                        listener.statusChanged(jobStatus);
                                    }
                                    Thread.sleep(60000);

                                    jobStatus = finalCluster.getJobStatus(jobID);
                                }
                                //Set the job status to Complete
                                listener.setJobStatus(JobStatus.C);
                                listener.statusChanged(jobStatus);
                                break;
                            }
                        } catch (InterruptedException e) {
                            log.error("Error listening to the submitted job", e);
                        } catch (SSHApiException e) {
                            log.error("Error listening to the submitted job", e);
                        }
                    }
                };
                //  This thread runs until the program termination, so that use can provide
//            // any action in onChange method of the listener, without worrying for waiting in the caller thread.
                t.setDaemon(false);
                t.start();
            } catch (Exception e) {
                String error = "Error during job status monitoring";
                log.error(error);
                throw new GFacProviderException(error, e);
            }
            while (!listener.isJobDone()) {
                Thread.sleep(10000);
            }
        } catch (SSHApiException e) {
            String error = "Error submitting the job to host " + host.getHostAddress() + e.getMessage();
            log.error(error);
            throw new GFacProviderException(error, e);
        } catch (Exception e) {
            String error = "Error submitting the job to host " + host.getHostAddress() + e.getMessage();
            log.error(error);
            throw new GFacProviderException(error, e);
        }
    }
View Full Code Here

        HostDescriptor hostDescriptor = new HostDescriptor();
        hostDescriptor.setHostname(hostDescription.getType().getHostName());
        hostDescriptor.setHostAddress(hostDescription.getType().getHostAddress());

        HostDescriptionType hostDescriptionType = hostDescription.getType();
        if (hostDescriptionType instanceof GlobusHostType){
            GlobusHostType globusHostType = (GlobusHostType) hostDescriptionType;
            hostType.add(HostTypes.GLOBUS_HOST_TYPE);
            String[] globusGateKeeperEndPointArray = globusHostType.getGlobusGateKeeperEndPointArray();
            for (int i = 0; i < globusGateKeeperEndPointArray.length ; i++){
View Full Code Here

    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
        log.info("Invoking GridFTPOutputHandler ...");

       ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();

      HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
      String[] gridFTPEndpointArray = null;
      String hostName = null;
       if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
          gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
View Full Code Here

    }

    private static void stageOutputFiles(JobExecutionContext jobExecutionContext, String outputFileStagingPath) throws GFacProviderException,GFacException {


         HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
         String[] gridFTPEndpointArray = null;

           if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
             gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
           }
View Full Code Here

        //TODO: why it is tightly coupled with gridftp
//        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();

        //TODO: make it more reusable
        HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();



        if(hostType instanceof GlobusHostType){
          gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
        }
        else if (hostType instanceof UnicoreHostType){
          gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
        }
        else {
          //TODO
        }


        ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
        ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
        GridFtp ftp = new GridFtp();

        try {




            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.
                    getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();

            if (gridFTPEndpointArray == null || gridFTPEndpointArray.length == 0) {
              gridFTPEndpointArray = new String[]{hostType.getHostAddress()};
            }
            boolean success = false;
            GFacHandlerException pe = null;// = new ProviderException("");
            for (String endpoint : gridFTPEndpointArray) {
                try {
View Full Code Here

        //TODO: why it is tightly coupled with gridftp
//        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();

        //TODO: make it more reusable
        HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();

        if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
          gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
        }
        else if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof UnicoreHostType){
View Full Code Here

TOP

Related Classes of org.apache.airavata.schemas.gfac.HostDescriptionType

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.