Package gri.tasks.managers.workflows

Examples of gri.tasks.managers.workflows.WorkflowManager


    public static void testWorkflow() throws Exception {
 
  //Create Manager:
  TaskProvider taskProvider = loadTaskProvider();
  //WorkflowManager wkflManager = createLocalWorkflowManager(taskProvider);
  WorkflowManager wkflManager = createRemoteWorkflowManager(taskProvider);
 
  //Define workflow:
  //WorkflowSubmission wkfl = createSimpleWorkflow();
  WorkflowSubmission wkfl = createFileWorkflow();
 
  //Execute:
  String id = wkflManager.submitWorkflow(wkfl);
  while (wkflManager.getWorkflowInfo(id).getStatus() != JobManager.COMPLETE) {
      System.out.println("Running...");
     
      try {
    Thread.sleep(200);
      }
      catch(Exception e) {};
  }
 
  System.out.println("Complete");
 
  //Print outputs:
  Map outputs1 = wkflManager.getWorkflowOutputs(id, 0);
  Map outputs2 = wkflManager.getWorkflowOutputs(id, 1);
 
  System.out.println("OUTPUT 1: " + String.valueOf(outputs1));
  System.out.println("OUTPUT 2: " + String.valueOf(outputs2));
 
  //Free workflow:
  wkflManager.freeWorkflow(id);
 
  System.out.println();
  System.out.println(wkflManager.listWorkflows().length + " workflows remain");
 
    }
View Full Code Here


     * WorkflowManagerService to another WorkflowManager.  This imitates the
     * way in which a remote system would act as all messages pass through
     * the service tunnel as XML.
     */
    protected static WorkflowManager createRemoteWorkflowManager(TaskProvider taskProvider) throws Exception {
        WorkflowManager localManager = createLocalWorkflowManager(taskProvider);
 
        File baseDir = new File("C:\\GRIDP_EXEC");
  SimpleJobFolderFactory jobFolderFactory = new SimpleJobFolderFactory(baseDir);
 
        WorkflowManagerServiceImpl webService = new WorkflowManagerServiceImpl(localManager, new BasicSerializerSet(), jobFolderFactory);
View Full Code Here

        try {
           
            //parse input:
            Element rootElem = xmlUtil.parseXML(xml).getRootElement();
           
            WorkflowManager wkflManager = getWorkflowManager();
           
            Map config = new HashMap();
            config.put("TASK_INFO_MANAGER", wkflManager);
            config.put("WORKFLOW_MANAGER", wkflManager);
            config.put("WORKFLOW_MANAGER_SERVICE", this);
            config.put("WORKING_DIRECTORY", workDir);
                  
            WorkflowSubmissionSerializer wkflSerializer = serializers
                .getWorkflowSerializerSet(wkflManager)
                .getWorkflowSubmissionSerializer(config);
           
            WorkflowSubmission wkfl = wkflSerializer.readWorkflow(rootElem);
            wkfl.setContextParam("WORKING_DIRECTORY", workDir);

            List jobs = wkfl.getJobs();
            for (int i=0; i<jobs.size(); i++) {
          JobSubmission job = (JobSubmission)jobs.get(i);
         
          String jobId = "job_" + (i+1);
          File subWorkDir = new File(workDir, jobId);
         
          job.setContextParam("WORKING_DIRECTORY", subWorkDir);
            }
           
            //submit:
            String wkflId = wkflManager.submitWorkflow(wkfl);
            logger.debug("Workflow submitted: " + wkflId);
           
            RunningJobInfo jobInfo = new RunningJobInfo(wkflId, null, workDir);
            jobInfoManager.storeJobInfo(jobInfo);
View Full Code Here

  int jobIndex = Integer.parseInt(req.getParameter("JOB_INDEX"));
 
  //process:
  try {
     
      WorkflowManager wkflManager = getWorkflowManager();
      WorkflowInfo wkflInfo = wkflManager.getWorkflowInfo(wkflId);
      String taskId = wkflInfo.getJobInfo(jobIndex).getTaskId();
     
      RunningJobInfo jobInfo = jobInfoManager.getJobInfo(wkflId);
                
            //create serializer config:
            Map config = new HashMap();
           
            config.putAll(req.getParameters())//do first (so user can't overwrite following params)
           
            config.put("WORKFLOW_MANAGER", wkflManager);
            config.put("WORKFLOW_MANAGER_SERVICE", this);
            config.put("WORKFLOW_ID", req.getJobId());
            config.put("WORKFLOW_ID", wkflId);
            config.put("WORKING_DIRECTORY", jobInfo.getWorkingDirectory())//TODO: this is wrong
           
           
            JDOMSerializer paramSerializer = serializers
              .getWorkflowSerializerSet(wkflManager)
              .getOutputParameterSerializer(jobIndex, taskId, config);
           
            //serialize:
            Map outputs = wkflManager.getWorkflowOutputs(wkflId, jobIndex);
           
            Element elem = new Element("outputs");
            paramSerializer.write(outputs, elem);
            return xmlUtil.writeXML(elem);
        }
View Full Code Here

TOP

Related Classes of gri.tasks.managers.workflows.WorkflowManager

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.