Package org.apache.airavata.schemas.gfac

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


      GridFTPDataMovement dataMovement) throws InvalidRequestException,
      AiravataClientException, AiravataSystemException, TException {
    try {
      HostDescription hostDescriptor = getRegistry().getHostDescriptor(computeResourceId);
      hostDescriptor.getType().changeType(GlobusHostType.type);
      GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
      if (dataMovement.getGridFTPEndPointSize()>0) {
        s.setGridFTPEndPointArray(dataMovement.getGridFTPEndPoint()
            .toArray(new String[] {}));
      }
      getRegistry().updateHostDescriptor(hostDescriptor);
      return computeResourceId;
    } catch (Exception e) {
View Full Code Here


      AiravataSystemException, TException {
    try {
      GridFTPDataMovement gridFTPDataMovement = new GridFTPDataMovement();
      gridFTPDataMovement.setDataMovementDataID(gridFTPDataMovementResourceId);
      HostDescription hostDescriptor = getRegistry().getHostDescriptor(gridFTPDataMovementResourceId);
      GlobusHostType s = (GlobusHostType)hostDescriptor.getType();
      gridFTPDataMovement.setGridFTPEndPoint(Arrays.asList(s.getGridFTPEndPointArray()));
      gridFTPDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
      return gridFTPDataMovement;
    } catch (Exception e) {
      e.printStackTrace();
      throw new AiravataSystemException();
View Full Code Here

        job.addListener(listener);
    }

    public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
        jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().
                getHostDescription().getType();
        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().
                getApplicationDeploymentDescription().getType();

        StringBuilder stringBuilder = new StringBuilder();
        try {

            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.
                    getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();
            job.setCredentials(gssCred);
            // We do not support multiple gatekeepers in XBaya GUI, so we simply pick the 0th element in the array
            String gateKeeper = host.getGlobusGateKeeperEndPointArray(0);
            log.info("Request to contact:" + gateKeeper);

            stringBuilder.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
                    .append(job.getRSL()).append(" working directory = ").append(app.getStaticWorkingDirectory())
                    .append(" temp directory = ").append(app.getScratchWorkingDirectory())
                    .append(" Globus GateKeeper Endpoint = ").append(gateKeeper);

            log.info(stringBuilder.toString());
View Full Code Here

    private void gridFTPTransfer(InvocationContext context, URI dest, String remoteSrcFile) throws SecurityException,
            ToolsException, URISyntaxException {
        GridFtp ftp = new GridFtp();
        GSSCredential gssCred = ((GSISecurityContext) context.getSecurityContext(MYPROXY_SECURITY_CONTEXT))
                .getGssCredentails();
        GlobusHostType host = (GlobusHostType) context.getExecutionDescription().getHost().getType();

        for (String endpoint : host.getGridFTPEndPointArray()) {
            try {
                URI srcURI = GfacUtils.createGsiftpURI(endpoint, remoteSrcFile);
                ftp.transfer(srcURI, dest, gssCred, true);
                return;
            } catch (ToolsException e) {
View Full Code Here

            throws SecurityException, ToolsException, URISyntaxException, IOException {
        GridFtp ftp = new GridFtp();
        GSSCredential gssCred = ((GSISecurityContext) context.getSecurityContext(MYPROXY_SECURITY_CONTEXT))
                .getGssCredentails();

        GlobusHostType host = (GlobusHostType) context.getExecutionDescription().getHost().getType();
       
        for (String endpoint : host.getGridFTPEndPointArray()) {
            try {
                URI destURI = GfacUtils.createGsiftpURI(endpoint, remoteLocation);
                InputStream in = null;
                try {
                    in = src.toURL().openStream();
View Full Code Here

    private void gridFTPTransfer(InvocationContext context, URI src, String remoteFile) throws SecurityException,
            ToolsException, URISyntaxException {
        GridFtp ftp = new GridFtp();
        GSSCredential gssCred = ((GSISecurityContext) context.getSecurityContext(MYPROXY_SECURITY_CONTEXT))
                .getGssCredentails();
        GlobusHostType host = (GlobusHostType) context.getExecutionDescription().getHost().getType();
       
        for (String endpoint : host.getGridFTPEndPointArray()) {
            try {
                URI inputURI = GfacUtils.createGsiftpURI(endpoint, remoteFile);
                ftp.transfer(src, inputURI, gssCred, true);
                return;
            } catch (ToolsException e) {
View Full Code Here

    private GramJob job;
    private String gateKeeper;
    private JobSubmissionListener listener;

    public void makeDirectory(InvocationContext invocationContext) throws ProviderException {
        GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
        ApplicationDeploymentDescriptionType app = invocationContext.getExecutionDescription().getApp().getType();

        GridFtp ftp = new GridFtp();

        try {
            gssContext = (GSISecurityContext)invocationContext.getSecurityContext(MYPROXY_SECURITY_CONTEXT);
            GSSCredential gssCred = gssContext.getGssCredentails();
            String[] hostgridFTP = host.getGridFTPEndPointArray();
            if (hostgridFTP == null || hostgridFTP.length == 0) {
                hostgridFTP = new String[] { host.getHostAddress() };
            }

            boolean success = false;
            ProviderException pe = new ProviderException("");

            for (String endpoint : host.getGridFTPEndPointArray()) {
                try {

                    URI tmpdirURI = GfacUtils.createGsiftpURI(endpoint, app.getScratchWorkingDirectory());
                    URI workingDirURI = GfacUtils.createGsiftpURI(endpoint, app.getStaticWorkingDirectory());
                    URI inputURI = GfacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
View Full Code Here

            throw new ProviderException(e.getMessage(), e);
        }
    }

    public void setupEnvironment(InvocationContext invocationContext) throws ProviderException {
        GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();

        log.info("Searching for Gate Keeper");
       
       
        String tmp[] = host.getGlobusGateKeeperEndPointArray();        
        if (tmp == null || tmp.length == 0) {
            gateKeeper = host.getHostAddress();
        }else{
            /*
             * TODO: algorithm for correct gatekeeper selection
             */   
            gateKeeper = tmp[0];
View Full Code Here

        }

    }

    public void executeApplication(InvocationContext invocationContext) throws ProviderException {
        GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
        ApplicationDeploymentDescriptionType app = invocationContext.getExecutionDescription().getApp().getType();

        StringBuffer buf = new StringBuffer();
        try {

            /*
             * Set Security
             */
            GSSCredential gssCred = gssContext.getGssCredentails();
            job.setCredentials(gssCred);

            log.info("Request to contact:" + gateKeeper);

            buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
                    .append(job.getRSL()).append(" working directory = ").append(app.getStaticWorkingDirectory())
                    .append(" tempDirectory = ").append(app.getScratchWorkingDirectory())
                    .append(" Globus GateKeeper cantact = ").append(gateKeeper);
            invocationContext.getExecutionContext().getNotifier().info(invocationContext, buf.toString());

            /*
             * The first boolean is to specify the job is a batch job - use true for interactive and false for batch.
             * The second boolean is to specify to use the full proxy and not delegate a limited proxy.
             */
            job.request(gateKeeper, false, false);
            String gramJobid = job.getIDAsString();
            log.info("JobID = " + gramJobid);
            invocationContext.getExecutionContext().getNotifier().info(invocationContext, "JobID=" + gramJobid);

            log.info(buf.toString());

            invocationContext
                    .getExecutionContext()
                    .getNotifier()
                    .applicationInfo(invocationContext, gramJobid, gateKeeper, null, null,
                            gssCred.getName().toString(), null, job.getRSL());

            /*
             * Block untill job is done
             */
            listener.waitFor();

            /*
             * Remove listener
             */
            job.removeListener(listener);

            /*
             * Fail job
             */
            int jobStatus = listener.getStatus();
            if (jobStatus == GramJob.STATUS_FAILED) {
                int errCode = listener.getError();
                String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Error Code = "
                        + errCode;
                JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
                        gateKeeper, job.getRSL());
                if (errCode == 8) {
                    error.setReason(JobSubmissionFault.JOB_CANCEL);
                } else {
                    error.setReason(JobSubmissionFault.JOB_FAILED);
                }
                throw error;
            }

        } catch (GramException e) {
            JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(), gateKeeper, job.getRSL());
            if (listener.getError() == 8) {
                error.setReason(JobSubmissionFault.JOB_CANCEL);
            } else {
                error.setReason(JobSubmissionFault.JOB_FAILED);
            }
View Full Code Here

        }

    }

    public Map<String, ?> processOutput(InvocationContext invocationContext) throws ProviderException {
        GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
        ApplicationDeploymentDescriptionType app = invocationContext.getExecutionDescription().getApp().getType();
        GridFtp ftp = new GridFtp();
        try {
            GSSCredential gssCred = gssContext.getGssCredentails();

            String[] hostgridFTP = host.getGridFTPEndPointArray();
            if (hostgridFTP == null || hostgridFTP.length == 0) {
                hostgridFTP = new String[] { host.getHostAddress() };
            }

            boolean success = false;
            ProviderException pe = new ProviderException("");

            for (String endpoint : host.getGridFTPEndPointArray()) {

                try {

                    /*
                     * Stdout and Stderror
View Full Code Here

TOP

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

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.