Examples of GFacProviderException


Examples of org.apache.airavata.gfac.core.provider.GFacProviderException

            Cluster cluster = null;
            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) != null) {
                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_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 = 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");
                GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
            } else {
                jobDetails.setJobID(jobID);
                GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.SUBMITTED);
            }
            data.append(",jobId=").append(jobDetails.getJobID());

            // Now job has submitted to the resource, its up to the Provider to parse the information to daemon handler
            // to perform monitoring, daemon handlers can be accessed from anywhere
            delegateToMonitorHandlers(jobExecutionContext, (GsisshHostType) host, jobID);
            // we know this host is type GsiSSHHostType
        } catch (SSHApiException e) {
            String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
            log.error(error);
            jobDetails.setJobID("none");
            GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
            GFacUtils.saveErrorDetails(jobExecutionContext, error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
            throw new GFacProviderException(error, e);
        } catch (Exception e) {
            String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
            log.error(error);
            jobDetails.setJobID("none");
            GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
            GFacUtils.saveErrorDetails(jobExecutionContext, error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
            throw new GFacProviderException(error, e);
        } finally {
            log.info("Saving data for future recovery: ");
            log.info(data.toString());
            GFacUtils.savePluginData(jobExecutionContext, data, this.getClass().getName());
        }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

    private void makeFileSystemDir(String dir, JobExecutionContext jobExecutionContext) throws GFacProviderException {
        File f = new File(dir);
        if (f.isDirectory() && f.exists()) {
            return;
        } else if (!new File(dir).mkdir()) {
            throw new GFacProviderException("Cannot make directory " + dir, jobExecutionContext);
        }
    }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

            log.debug("RSL = " + rsl);
            GramJob job = new GramJob(rsl);
            return job;
        } catch (ToolsException te) {
            throw new GFacProviderException(te.getMessage(), te, jobExecutionContext);
        }
    }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

                    if(cpuCount>0){
                        app.setCpuCount(cpuCount);
                    }
                } catch (NullPointerException e) {
                    log.debug("No Value sent in WorkflowContextHeader for CPU Count, value in the Deployment Descriptor will be used");
                    new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
                try {
                    int nodeCount = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getNodeCount();
                    if(nodeCount>0){
                        app.setNodeCount(nodeCount);
                    }
                } catch (NullPointerException e) {
                    log.debug("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used");
                     new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
                try {
                    String queueName = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getQueueName();
                    if (queueName != null) {
                        if(app.getQueue() == null){
                            QueueType queueType = app.addNewQueue();
                            queueType.setQueueName(queueName);
                        }else{
                            app.getQueue().setQueueName(queueName);
                        }
                    }
                } catch (NullPointerException e) {
                    log.debug("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used");
                     new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
            }
        }
        if(currentContextHeader.getWorkflowOutputDataHandling() != null){
            if(currentContextHeader.getWorkflowOutputDataHandling().getApplicationOutputDataHandlingArray().length != 0)
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

                    }

                }
            } catch (URISyntaxException e) {
                log.error(e.getMessage());
                throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
            } catch (ToolsException e) {
                log.error(e.getMessage());
                throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
            }
            outputNew.getParameters().put(paramName, actualParameter);
        }
        jobExecutionContext.setOutMessageContext(outputNew);
    }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

       
        try {
      cad.addNewCreateActivity().addNewActivityDocument()
              .setJobDefinition(JSDLGenerator.buildJSDLInstance(jobExecutionContext).getJobDefinition());
    } catch (Exception e1) {
      throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.",e1);
    }
       
        FactoryClient factory = null;
        try {
            factory = new FactoryClient(eprt, secProperties);
        } catch (Exception e) {
            throw new GFacProviderException("");
        }
        CreateActivityResponseDocument response = null;
        try {
            log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
            response = factory.createActivity(cad);
            log.info(String.format("Activity Submitted to %s \n", factoryUrl));
        } catch (Exception e) {
          e.printStackTrace();
            throw new GFacProviderException("Cannot create activity.", e);
        }
        EndpointReferenceType activityEpr = response
                .getCreateActivityResponse().getActivityIdentifier();
       
        log.debug("Activity EPR: "+activityEpr);
       
        log.info("Activity: "+activityEpr.getAddress().getStringValue()" Submitted.");
       
        //factory.waitWhileActivityIsDone(activityEpr, 1000);
        jobId = WSUtilities.extractResourceID(activityEpr);
        if (jobId == null) {
            jobId = new Long(Calendar.getInstance().getTimeInMillis())
                    .toString();
        }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), factory.getActivityStatus(activityEpr)
                .toString()));
       
       
        //TODO publish the status messages to the message bus
        while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
         
            ActivityStatusType activityStatus = null;
        try {
          activityStatus = getStatus(factory, activityEpr);
          log.info (subStatusAsString(activityStatus));
        } catch (UnknownActivityIdentifierFault e) {
          throw new GFacProviderException(e.getMessage(), e.getCause());
        }
 
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            continue;
        }
       
        ActivityStatusType activityStatus = null;
    try {
      activityStatus = getStatus(factory, activityEpr);
    } catch (UnknownActivityIdentifierFault e) {
      throw new GFacProviderException(e.getMessage(), e.getCause());
    }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString()));
       
    if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

          secProperties.setOutHandlerClassNames(outHandlerLst.toArray(new String[outHandlerLst.size()]));
         
         
    }
    catch (Exception e) {
      throw new GFacProviderException(e.getMessage(), e);
    }
    finally{
      try {
        if(bos!=null)bos.close();
        if(bufos!=null)bufos.close();
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

                    .append(String.valueOf(returnValue));

            log.info(buf.toString());

        } catch (IOException io) {
            throw new GFacProviderException(io.getMessage(), io,jobExecutionContext);
        } catch (InterruptedException e) {
            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
        }
    }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

        try {
            String stdOutStr = GFacUtils.readFileToString(app.getStandardOutput());
            String stdErrStr = GFacUtils.readFileToString(app.getStandardError());
            OutputUtils.fillOutputFromStdout(jobExecutionContext, stdOutStr, stdErrStr);
        } catch (XmlException e) {
            throw new GFacProviderException("Cannot read output:" + e.getMessage(), e, jobExecutionContext);
        } catch (IOException io) {
            throw new GFacProviderException(io.getMessage(), io, jobExecutionContext);
        } catch (Exception e){
          throw new GFacProviderException("Error in retrieving results",e,jobExecutionContext);
        }
    }
View Full Code Here

Examples of org.apache.airavata.gfac.provider.GFacProviderException

            String hostName = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostName();
            WorkflowNodeGramData workflowNodeGramData = new WorkflowNodeGramData(experimentID, nodeID, job.getRSL(),hostName , job.getIDAsString());
            try {
                jobExecutionContext.getGFacConfiguration().getAiravataAPI().getProvenanceManager().updateWorkflowNodeGramData(workflowNodeGramData);
            } catch (AiravataAPIInvocationException e) {
                throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
            }
            log.info(buf.toString());
            /*
            * Block untill job is done
            */
            listener.waitFor();


            /*
            * Fail job
            */
            int jobStatus = listener.getStatus();

//            if (job.getExitCode() != 0 || jobStatus == GramJob.STATUS_FAILED) {
              if (jobStatus == GramJob.STATUS_FAILED) {
                int errCode = listener.getError();
                String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Job Exit Code = "
                        + listener.getError();
                JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
                        gateKeeper, job.getRSL(), jobExecutionContext);
                throw error;
            }
        } catch (GramException e) {
            log.error(e.getMessage());
            JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(),
                    host.getGlobusGateKeeperEndPointArray(0), job.getRSL(), jobExecutionContext);
            throw error;
        } catch (GSSException e) {
            log.error(e.getMessage());
            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
        } catch (InterruptedException e) {
            log.error(e.getMessage());
            throw new GFacProviderException("Thread", e, jobExecutionContext);
        } catch (SecurityException e) {
            log.error(e.getMessage());
            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
        } finally {
            if (job != null) {
                try {
                   /*
                     * Remove listener
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.