Examples of JobSubmissionListener


Examples of org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener

            String rsl = jobAttr.toRSL();

            log.debug("RSL = " + rsl);

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te, invocationContext);
        }
View Full Code Here

Examples of org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener

            String rsl = jobAttr.toRSL();

            log.info("RSL = " + rsl);

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te, invocationContext);
        }
View Full Code Here

Examples of org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener

            String rsl = jobAttr.toRSL();

            log.info("RSL = " + rsl);

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te, invocationContext);
        }
View Full Code Here

Examples of org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener

            String rsl = jobAttr.toRSL();

            log.info("RSL = " + rsl);

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te);
        }
View Full Code Here

Examples of org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener

            String rsl = jobAttr.toRSL();

            log.info("RSL = " + rsl);

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te);
        }
View Full Code Here

Examples of org.apache.airavata.gsi.ssh.listener.JobSubmissionListener

            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);
View Full Code Here

Examples of org.ogce.gfac.provider.utils.JobSubmissionListener

      NotificationService notifier = context.getNotificationService();
      DurationObj compObj = notifier.computationStarted();
      StringBuffer buf = new StringBuffer();

      JobSubmissionListener listener = new JobSubmissionListener(job, context);
      job.addListener(listener);
      log.info("Request to contact:" + contact);
      // 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(contact, false, false);

      log.info("JobID = " + job.getIDAsString());

      // Gram.request(contact, job, false, false);

      buf.append("Finished launching job, Host = ").append(context.getExecutionModel().getHost()).append(" RSL = ").append(job.getRSL()).append("working directory =").append(context.getExecutionModel().getWorkingDir()).append("tempDirectory =").append(context.getExecutionModel().getTmpDir())
          .append("Globus GateKeeper cantact = ").append(contact);
      context.getNotificationService().info(buf.toString());
      String gramJobid = job.getIDAsString();
      context.getNotificationService().info("JobID=" + gramJobid);
      log.info(buf.toString());
      // Send Audit Notifications
      notifier.appAudit(invocationContext.getServiceName(), new URI(job.getIDAsString()), contact, null, null, gssCred.getName().toString(), null, job.getRSL());

      listener.waitFor();
      job.removeListener(listener);

      int jobStatus = listener.getStatus();
      if (jobStatus == GramJob.STATUS_FAILED) {
        errCode = listener.getError();
        // Adding retry for error code to properties files as
        // gfac.retryonJobErrorCodes with comma separated
        if (context.getServiceContext().getGlobalConfiguration().getRetryonErrorCodes().contains(Integer.toString(errCode))) {
          try {
            log.info("Job Failed with Error code " + errCode + " and job id: " + gramJobid);
            log.info("Retry job sumttion one more time for error code" + errCode);
            job = new GramJob(rsl);
            job.setCredentials(gssCred);
            listener = new JobSubmissionListener(job, context);
            job.addListener(listener);
            job.request(contact, false, false);
            String newGramJobid = job.getIDAsString();
            String jobStatusMessage = GfacUtils.formatJobStatus(newGramJobid, "RETRY");
            context.getNotificationService().info(jobStatusMessage);
            context.getNotificationService().info("JobID=" + newGramJobid);
            notifier.appAudit(context.getServiceContext().getService().getService().getServiceName().getStringValue(), new URI(job.getIDAsString()), contact, null, null, gssCred.getName().toString(), null, job.getRSL());
            listener.waitFor();
            job.removeListener(listener);
            int jobStatus1 = listener.getStatus();
            if (jobStatus1 == GramJob.STATUS_FAILED) {
              int errCode1 = listener.getError();
              String errorMsg = "Job " + job.getID() + " on host " + context.getExecutionModel().getHost() + " Error Code = " + errCode1;
              String localHost = context.getServiceContext().getGlobalConfiguration().getLocalHost();
              throw new JobSubmissionFault(new Exception(errorMsg), localHost, "", "", CurrentProviders.Gram);
            }
          } catch (Exception e) {
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.