Package org.apache.oodt.cas.resource.structs

Examples of org.apache.oodt.cas.resource.structs.JobSpec


        Job exec = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
        JobInput in = GenericResourceManagerObjectFactory
                .getJobInputFromClassName(exec.getJobInputClassName());
        in.read(jobIn);

        JobSpec spec = new JobSpec(in, exec);

        URL remoteUrl = safeGetUrlFromString(urlStr);
        ResourceNode remoteNode = null;

        try {
View Full Code Here


                Thread.currentThread().sleep((long) waitTime * 1000);
            } catch (InterruptedException ignore) {
            }

            if (!myJobQueue.isEmpty()) {
                JobSpec exec = null;

                try {
                    exec = myJobQueue.getNextJob();
                    LOG.log(Level.INFO, "Obtained Job: ["
                            + exec.getJob().getId()
                            + "] from Queue: Scheduling for execution");
                } catch (JobQueueException e) {
                    LOG.log(Level.WARNING,
                            "Error getting next job from JobQueue: Message: "
                                    + e.getMessage());
                    continue;
                }

                try {
                    schedule(exec);
                } catch (SchedulerException e) {
                    LOG.log(Level.WARNING, "Error scheduling job: ["
                            + exec.getJob().getId() + "]: Message: "
                            + e.getMessage());
                    // place the job spec back on the queue
                    try {
                        myJobQueue.addJob(exec);
                    } catch (Exception ignore) {
View Full Code Here

        j1.setId("booger");
        j1.setName("pick it");

        JobInput in = null;

        job1 = new JobSpec(in, j1);

        Job j2 = new Job();
        j2.setId("booger2");
        j2.setName("pick some more");
        job2 = new JobSpec(in, j2);
    }
View Full Code Here

    }

    public void testGetNextJob() {
        JobStack stack = new JobStack(waitTime, repo);
        JobSpec nextJob = null;

        try {
            stack.addJob(job1);
            stack.addJob(job2);
            stack.addJob(job2);

            List queuedJobs = stack.getQueuedJobs();

            nextJob = stack.getNextJob();
            assertEquals(nextJob.getJob().getId(), job1.getJob().getId());
            assertEquals(queuedJobs.size(), 2);
            nextJob = stack.getNextJob();
            assertEquals(nextJob.getJob().getId(), job2.getJob().getId());
            assertEquals(queuedJobs.size(), 1);
            nextJob = stack.getNextJob();
            assertEquals(nextJob.getJob().getId(), job2.getJob().getId());
            assertEquals(queuedJobs.size(), 0);
        } catch (Exception e) {
            fail(e.getMessage());
        }
View Full Code Here

   public void testSubmitJob() throws MalformedURLException {
      String jobDefinitionFile = "src/main/resources/examples/jobs/exJob.xml";
      cmdLineUtility.run(("--url http://localhost:9000"
            + " --operation --submitJob --def "
            + jobDefinitionFile).split(" "));
      JobSpec spec = JobBuilder.buildJobSpec(jobDefinitionFile);
      MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
      assertEquals("submitJob", methodCallDetails.getMethodName());
      Job actualJob = (Job) methodCallDetails.getArgs().get(0);
      assertEquals(spec.getJob().getJobInstanceClassName(), actualJob.getJobInstanceClassName());
      assertEquals(spec.getJob().getJobInputClassName(), actualJob.getJobInputClassName());
      assertEquals(spec.getJob().getQueueName(), actualJob.getQueueName());
      assertEquals(spec.getJob().getLoadValue(), actualJob.getLoadValue());
      JobInput actualJobInput = (JobInput) methodCallDetails.getArgs().get(1);
      assertEquals(spec.getIn().getClass(), actualJobInput.getClass());
      assertEquals(2, methodCallDetails.getArgs().size());

      OptionPropertyRegister.clearRegister();

      String url = "http://localhost:9000";
      cmdLineUtility.run(("--url http://localhost:9000"
            + " --operation --submitJob --def "
            + jobDefinitionFile + " --nodeUrl " + url).split(" "));
      methodCallDetails = client.getLastMethodCallDetails();
      assertEquals("submitJob", methodCallDetails.getMethodName());
      actualJob = (Job) methodCallDetails.getArgs().get(0);
      assertEquals(spec.getJob().getJobInstanceClassName(), actualJob.getJobInstanceClassName());
      assertEquals(spec.getJob().getJobInputClassName(), actualJob.getJobInputClassName());
      assertEquals(spec.getJob().getQueueName(), actualJob.getQueueName());
      assertEquals(spec.getJob().getLoadValue(), actualJob.getLoadValue());
      actualJobInput = (JobInput) methodCallDetails.getArgs().get(1);
      assertEquals(spec.getIn().getClass(), actualJobInput.getClass());
      assertEquals(new URL(url), methodCallDetails.getArgs().get(2));
      assertEquals(3, methodCallDetails.getArgs().size());
   }
View Full Code Here

   public void execute(ActionMessagePrinter printer)
         throws CmdLineActionException {
      try {
         Validate.notNull(jobDefinitionFile, "Must specify jobDefinitionFile");

         JobSpec spec = JobBuilder.buildJobSpec(jobDefinitionFile);
         if (url == null) {
            printer.println("Successful submit job with jobId '"
                  + getClient().submitJob(spec.getJob(), spec.getIn()) + "'");
         } else {
            if (getClient().submitJob(spec.getJob(), spec.getIn(), url)) {
               printer.println("Successfully submitted job to url '"
                     + url + "'");
            } else {
               throw new Exception("Job submit returned false");
            }
View Full Code Here

        throw new JobRepositoryException("Failed to get capacity of JobQueue : " + e.getMessage(), e);
      }
    }

    public boolean isJobComplete(String jobId) throws JobRepositoryException {
        JobSpec spec = scheduler.getJobQueue().getJobRepository().getJobById(
                jobId);
        return scheduler.getJobQueue().getJobRepository().jobFinished(spec);
    }
View Full Code Here

                jobId);
        return scheduler.getJobQueue().getJobRepository().jobFinished(spec);
    }

    public Hashtable getJobInfo(String jobId) throws JobRepositoryException {
        JobSpec spec = null;

        try {
            spec = scheduler.getJobQueue().getJobRepository()
                    .getJobById(jobId);
        } catch (JobRepositoryException e) {
            LOG.log(Level.WARNING,
                    "Exception communicating with job repository for job: ["
                            + jobId + "]: Message: " + e.getMessage());
            throw new JobRepositoryException("Unable to get job: [" + jobId
                    + "] from repository!");
        }

        return XmlRpcStructFactory.getXmlRpcJob(spec.getJob());
    }
View Full Code Here

        Job exec = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
        JobInput in = GenericResourceManagerObjectFactory
                .getJobInputFromClassName(exec.getJobInputClassName());
        in.read(jobIn);

        JobSpec spec = new JobSpec(in, exec);

        // queue the job up
        String jobId = null;

        try {
View Full Code Here

        Job exec = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
        JobInput in = GenericResourceManagerObjectFactory
                .getJobInputFromClassName(exec.getJobInputClassName());
        in.read(jobIn);

        JobSpec spec = new JobSpec(in, exec);

        URL remoteUrl = safeGetUrlFromString(urlStr);
        ResourceNode remoteNode = null;

        try {
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.resource.structs.JobSpec

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.