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

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


    try {
      URL managerUrl = new URL(Args[0]);
      XmlRpcResourceManagerClient client = new XmlRpcResourceManagerClient(
          managerUrl);

      Job hw1 = new Job("JobOne", "HelloWorldJob",
          "org.apache.oodt.cas.resource.examples.HelloWorldJob",
          "org.apache.oodt.cas.resource.structs.NameValueJobInput", "quick",
          new Integer(1));
      NameValueJobInput hw1Input = new NameValueJobInput();
      hw1Input.setNameValuePair("user.name", "Dave");
View Full Code Here


            throws JobException {
        return genericExecuteJob(jobHash, jobInput);
    }

    public synchronized boolean killJob(Hashtable jobHash) {
        Job job = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
        Thread jobThread = (Thread) jobThreadMap.get(job.getId());
        if (jobThread == null) {
            LOG.log(Level.WARNING, "Job: [" + job.getId()
                    + "] not managed by this batch stub");
            return false;
        }

        // okay, so interrupt it, which should cause it to stop
View Full Code Here

    private boolean genericExecuteJob(Hashtable jobHash, Object jobInput)
            throws JobException {
        JobInstance exec = null;
        JobInput in = null;
        try {
            Job job = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);

            LOG.log(Level.INFO, "stub attempting to execute class: ["
                    + job.getJobInstanceClassName() + "]");

            exec = GenericResourceManagerObjectFactory
                    .getJobInstanceFromClassName(job.getJobInstanceClassName());
            in = GenericResourceManagerObjectFactory
                    .getJobInputFromClassName(job.getJobInputClassName());

            // load the input obj
            in.read(jobInput);

            // create threaded job
            // so that it can be interrupted
            RunnableJob runner = new RunnableJob(exec, in);
            Thread threadRunner = new Thread(runner);
            /* save this job thread in a map so we can kill it later */
            jobThreadMap.put(job.getId(), threadRunner);
            threadRunner.start();

            try {
                threadRunner.join();
            } catch (InterruptedException e) {
                LOG.log(Level.INFO, "Current job: [" + job.getName()
                        + "]: killed: exiting gracefully");
                synchronized (jobThreadMap) {
                    Thread endThread = (Thread) jobThreadMap.get(job.getId());
                    if (endThread != null)
                        endThread = null;
                }
                return false;
            }

            synchronized (jobThreadMap) {
                Thread endThread = (Thread) jobThreadMap.get(job.getId());
                if (endThread != null)
                    endThread = null;
            }

            return true;
View Full Code Here

  jobHash.put("job.status", job.getStatus() != null ? job.getStatus() : "");
    return jobHash;
  }

  public static Job getJobFromXmlRpc(Hashtable jobHash) {
    Job job = new Job();
    job.setId((String) jobHash.get("job.id"));
    job.setName((String) jobHash.get("job.name"));
    job.setJobInputClassName((String) jobHash.get("job.inputClassName"));
    job.setJobInstanceClassName((String) jobHash
        .get("job.instanceClassName"));
    job.setQueueName((String)jobHash.get("job.queueName"));
    job.setLoadValue((Integer)jobHash.get("job.load"));
  job.setStatus((String)jobHash.get("job.status"));
    return job;
  }
View Full Code Here

                    }
                }
            }
        }

        Job job = new Job();
        job.setId(jobId);
        job.setName(jobName);
        job.setJobInstanceClassName(instClass);
        job.setJobInputClassName(inputClassName);
        job.setQueueName(queue);
        job.setLoadValue(load);

        JobInput in = GenericResourceManagerObjectFactory
                .getJobInputFromClassName(inputClassName);
        if (inputConfigProps != null) {
            in.configure(inputConfigProps);
View Full Code Here

        XmlRpcBatchMgrProxy proxy = new XmlRpcBatchMgrProxy(spec, node, this);
        return proxy.killJob();
    }

    protected void notifyMonitor(ResourceNode node, JobSpec jobSpec) {
        Job job = jobSpec.getJob();
        int reducedLoad = job.getLoadValue().intValue();
        try {
            mon.reduceLoad(node, reducedLoad);
        } catch (MonitorException e) {
        }
    }
View Full Code Here

    }

    private String genericHandleJob(Hashtable jobHash, Object jobIn)
            throws SchedulerException {

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

        JobSpec spec = new JobSpec(in, exec);

        // queue the job up
View Full Code Here

        return jobId;
    }

    private boolean genericHandleJob(Hashtable jobHash, Object jobIn,
            String urlStr) throws JobExecutionException {
        Job exec = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
        JobInput in = GenericResourceManagerObjectFactory
                .getJobInputFromClassName(exec.getJobInputClassName());
        in.read(jobIn);

        JobSpec spec = new JobSpec(in, exec);

        URL remoteUrl = safeGetUrlFromString(urlStr);
View Full Code Here

        // ----------------------------------------------------------------
        // create a default JobSpec
        // ----------------------------------------------------------------
        JobSpec spec = JobBuilder.buildJobSpec(jobFile.getAbsolutePath());
        Job job = spec.getJob();
        NameValueJobInput jobInput = (NameValueJobInput) spec.getIn();

        // ----------------------------------------------------------------
        // open the file to read. traverse through the list of directories
        // name given & override the default Job's runDirName value with the
View Full Code Here

            if (jobId == null) {
                System.err.println(getJobInfoOperation);
                System.exit(1);
            }

            Job jobInfo = client.getJobInfo(jobId);

            System.out.println("Job: [id=" + jobId + ", status="
                    + getReadableJobStatus(jobInfo.getStatus()) + ",name="
                    + jobInfo.getName() + ",queue=" + jobInfo.getQueueName()
                    + ",load=" + jobInfo.getLoadValue() + ",inputClass="
                    + jobInfo.getJobInputClassName() + ",instClass="
                    + jobInfo.getJobInstanceClassName() + "]");
        } else
            throw new IllegalArgumentException("Unknown Operation!");

    }
View Full Code Here

TOP

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

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.