Package org.apache.airavata.gfac

Examples of org.apache.airavata.gfac.GFacException


        log.debug("Initializing " + this.getClass().getName());
        if (jobExecutionContext.getRegistry() == null) {
            try {
                registry = RegistryFactory.getDefaultRegistry();
            } catch (RegistryException e) {
                throw new GFacException("Unable to create registry instance", e);
            }
        } else {
            registry = jobExecutionContext.getRegistry();
        }
        details = new JobDetails();
View Full Code Here


        log.debug("Initializing " + this.getClass().getName());
        if(jobExecutionContext.getRegistry() == null) {
            try {
                registry = RegistryFactory.getDefaultRegistry();
            } catch (RegistryException e) {
                throw new GFacException("Unable to create registry instance", e);
            }
        }else{
            registry = jobExecutionContext.getRegistry();
        }
    details = new JobDetails();
View Full Code Here

        try {
            jobExecutionContext = createJEC(experimentID, taskID, gatewayID);
            return submitJob(jobExecutionContext);
        } catch (Exception e) {
            log.error("Error inovoking the job with experiment ID: " + experimentID);
            throw new GFacException(e);
        }
    }
View Full Code Here

        // 1. Get the Task from the task ID and construct the Job object and save it in to registry
        // 2. Add another property to jobExecutionContext and read them inside the provider and use it.
        String serviceName = taskData.getApplicationId();
        if (serviceName == null) {
            throw new GFacException("Error executing the job because there is not Application Name in this Experiment:  " + serviceName );
        }
      
        ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName);
        if (serviceDescription == null ) {
            throw new GFacException("Error executing the job because there is not Application Name in this Experiment:  " + serviceName );
        }
        String hostName;
        HostDescription hostDescription = null;
        if(taskData.getTaskScheduling().getResourceHostId() != null){
            hostName = taskData.getTaskScheduling().getResourceHostId();
            hostDescription = airavataRegistry2.getHostDescriptor(hostName);
        }else{
            List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
              Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName);
              for (String hostDescName : applicationDescriptors.keySet()) {
                  registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName));
              }
              Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
             HostScheduler hostScheduler = aClass.newInstance();
             //TODO cleanup
            hostDescription = registeredHosts.get(0);//hostScheduler.schedule(registeredHosts);
          hostName = hostDescription.getType().getHostName();
        }
        if(hostDescription == null){
          throw new GFacException("Error executing the job as the host is not registered " + hostName)
        }
        ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName);
        URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
        Properties configurationProperties = ServerSettings.getProperties();
        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);
View Full Code Here

                log.error("Error occured during updating the statuses of Experiments,tasks or Job statuses to failed, " +
                        "NullPointerException occurred because at this point there might not have Job Created", e1, e);
            }
            jobExecutionContext.setProperty(ERROR_SENT, "true");
            jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause()));
            throw new GFacException(e.getMessage(), e);
        }
    }
View Full Code Here

    private void initProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
        try {
            provider.initialize(jobExecutionContext);
        } catch (Exception e) {
            throw new GFacException("Error while initializing provider " + provider.getClass().getName() + ".", e);
        }
    }
View Full Code Here

    private void executeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
        try {
             provider.execute(jobExecutionContext);
        } catch (Exception e) {
            throw new GFacException("Error while executing provider " + provider.getClass().getName() + " functionality.", e);
        }
    }
View Full Code Here

    private void disposeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
        try {
            provider.dispose(jobExecutionContext);
        } catch (Exception e) {
            throw new GFacException("Error while invoking provider " + provider.getClass().getName() + " dispose method.", e);
        }
    }
View Full Code Here

            try {
                handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
                handler = handlerClass.newInstance();
                handler.initProperties(handlerClassName.getProperties());
            } catch (ClassNotFoundException e) {
                throw new GFacException("Cannot load handler class " + handlerClassName, e);
            } catch (InstantiationException e) {
                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
            } catch (IllegalAccessException e) {
                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
            }
            try {
                handler.invoke(jobExecutionContext);
            } catch (GFacHandlerException e) {
                throw new GFacException("Error Executing a InFlow Handler", e.getCause());
            }
        }
    }
View Full Code Here

            try {
                jobExecutionContext = createJEC(jobExecutionContext.getExperimentID(),
                        jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getGatewayID());
            } catch (Exception e) {
                log.error("Error constructing job execution context during outhandler invocation");
                throw new GFacException(e);
            }
            schedule(jobExecutionContext);
        }
        for (GFacHandlerConfig handlerClassName : handlers) {
            Class<? extends GFacHandler> handlerClass;
            GFacHandler handler;
            try {
                handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
                handler = handlerClass.newInstance();
                handler.initProperties(handlerClassName.getProperties());
            } catch (ClassNotFoundException e) {
                log.error(e.getMessage());
                throw new GFacException("Cannot load handler class " + handlerClassName, e);
            } catch (InstantiationException e) {
                log.error(e.getMessage());
                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
            } catch (IllegalAccessException e) {
                log.error(e.getMessage());
                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
            }
            try {
                handler.invoke(jobExecutionContext);
            } catch (Exception e) {
                // TODO: Better error reporting.
                throw new GFacException("Error Executing a OutFlow Handler", e);
            }
        }

        monitorPublisher.publish(GfacExperimentState.COMPLETED);
        // At this point all the execution is finished so we update the task and experiment statuses.
View Full Code Here

TOP

Related Classes of org.apache.airavata.gfac.GFacException

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.