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

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


        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

                    }
                }
            }
        }

        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

            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

            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 runner.wasSuccessful();
View Full Code Here

   * .cas.workflow.structs.WorkflowTask, org.apache.oodt.cas.metadata.Metadata)
   */
  @Override
  public void execute(WorkflowTask workflowTask, Metadata dynMetadata)
      throws Exception {
    Job workflowTaskJob = new Job();
    workflowTaskJob.setName(workflowTask.getTaskId());
    workflowTaskJob
        .setJobInstanceClassName("org.apache.oodt.cas.workflow.structs.TaskJob");
    workflowTaskJob
        .setJobInputClassName("org.apache.oodt.cas.workflow.structs.TaskJobInput");
    workflowTaskJob.setLoadValue(new Integer(2));
    workflowTaskJob.setQueueName(workflowTask.getTaskConfig().getProperty(
        QUEUE_NAME) != null ? workflowTask.getTaskConfig().getProperty(
        QUEUE_NAME) : DEFAULT_QUEUE_NAME);

    if (workflowTask.getTaskConfig().getProperty(TASK_LOAD) != null) {
      workflowTaskJob.setLoadValue(Integer.valueOf(workflowTask.getTaskConfig()
          .getProperty(TASK_LOAD)));
    }

    TaskJobInput in = new TaskJobInput();
    in.setDynMetadata(dynMetadata);
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.