Package org.apache.oodt.cas.workflow.util

Examples of org.apache.oodt.cas.workflow.util.ScriptFile


   }

   protected ScriptFile buildPgeRunScript() {
      logger.fine("Creating PGE run script for shell [" + pgeConfig.getShellType()
                  + "] with contents " + pgeConfig.getExeCmds());
      ScriptFile sf = new ScriptFile(pgeConfig.getShellType());
      sf.setCommands(pgeConfig.getExeCmds());
      return sf;
   }
View Full Code Here


      logger.fine("Generated script file name [" + pgeScriptName + "]");
      return pgeScriptName;
   }

   protected void runPge() throws Exception {
      ScriptFile sf = null;
      try {
         long startTime = System.currentTimeMillis();
         logger.info("PGE start time [" + new Date(startTime) + "]");

         // create script to run
         sf = buildPgeRunScript();
         sf.writeScriptFile(getScriptPath().getAbsolutePath());

         // run script and evaluate whether success or failure
         updateStatus(RUNNING_PGE.getWorkflowStatusName());
         logger.info("Starting execution of PGE...");
         if (!wasPgeSuccessful(ExecUtils.callProgram(
               pgeConfig.getShellType() + " " + getScriptPath(), logger,
               new File(pgeConfig.getExeDir()).getAbsoluteFile()))) {
            throw new RuntimeException("Pge didn't finish successfully");
         } else {
            logger.info(
                  "Successfully completed running: '" + sf.getCommands() + "'");
         }

         long endTime = System.currentTimeMillis();
         logger.info("PGE end time [" + new Date(startTime) + "]");

         long runTime = endTime - startTime;
         logger.info("PGE runtime in millis [" + runTime + "]");

         pgeMetadata.replaceMetadata(PGE_RUNTIME, Long.toString(runTime));

      } catch (Exception e) {
         throw new Exception("Exception when executing PGE commands '"
               + (sf != null ? sf.getCommands() : "NULL") + "' : "
               + e.getMessage(), e);
      }
   }
View Full Code Here

    new SerializableMetadata(metadata, "UTF-8", false)
        .writeMetadataToXmlStream(new FileOutputStream(toMetFilePath));
  }

    protected ScriptFile buildPgeRunScript() {
        ScriptFile sf = new ScriptFile(this.pgeConfig.getShellType());
        sf.setCommands(this.pgeConfig.getExeCmds());
        return sf;
    }
View Full Code Here

        handler.close();
      }
    }
   
    protected void runPge() throws Exception {
        ScriptFile sf = null;
        Handler handler = null;
        Logger pgeLogger = null;
        try {
            long startTime = System.currentTimeMillis();

            // create script to run
            sf = this.buildPgeRunScript();
            sf.writeScriptFile(this.getScriptPath());

            // run script and evaluate whether success or failure
            handler = this.initializePgeLogHandler();
            pgeLogger = this.initializePgeLogger(handler);
            this.updateStatus(PgeTaskMetadataKeys.RUNNING_PGE);
            if (!this.wasPgeSuccessful(ExecUtils.callProgram(this.pgeConfig
                    .getShellType()
                    + " " + this.getScriptPath(), pgeLogger, new File(this.pgeConfig
                    .getExeDir()).getAbsoluteFile())))
                throw new RuntimeException("Pge didn't finish successfully");
            else
                LOG.log(Level.INFO, "Successfully completed running: '"
                        + sf.getCommands() + "'");
          
           
            long endTime = System.currentTimeMillis();
            this.pgeMetadata.addCustomMetadata(PgeTaskMetadataKeys.PGE_RUNTIME,
                    (endTime - startTime) + "");

        } catch (Exception e) {
            e.printStackTrace();
            throw new Exception("Exception when executing PGE commands '"
                    + (sf != null ? sf.getCommands() : "NULL") + "' : "
                    + e.getMessage());
        }finally {
          this.closePgeLogHandler(pgeLogger, handler);
        }
    }
View Full Code Here

   }

   protected ScriptFile buildPgeRunScript() {
      logger.fine("Creating PGE run script for shell [" + pgeConfig.getShellType()
                  + "] with contents " + pgeConfig.getExeCmds());
      ScriptFile sf = new ScriptFile(pgeConfig.getShellType());
      sf.setCommands(pgeConfig.getExeCmds());
      return sf;
   }
View Full Code Here

      logger.fine("Generated script file name [" + pgeScriptName + "]");
      return pgeScriptName;
   }

   protected void runPge() throws Exception {
      ScriptFile sf = null;
      try {
         long startTime = System.currentTimeMillis();
         logger.info("PGE start time [" + new Date(startTime) + "]");

         // create script to run
         sf = buildPgeRunScript();
         sf.writeScriptFile(getScriptPath().getAbsolutePath());

         // run script and evaluate whether success or failure
         updateStatus(RUNNING_PGE.getWorkflowStatusName());
         logger.info("Starting execution of PGE...");
         if (!wasPgeSuccessful(ExecUtils.callProgram(
               pgeConfig.getShellType() + " " + getScriptPath(), logger,
               new File(pgeConfig.getExeDir()).getAbsoluteFile()))) {
            throw new RuntimeException("Pge didn't finish successfully");
         } else {
            logger.info(
                  "Successfully completed running: '" + sf.getCommands() + "'");
         }

         long endTime = System.currentTimeMillis();
         logger.info("PGE end time [" + new Date(startTime) + "]");

         long runTime = endTime - startTime;
         logger.info("PGE runtime in millis [" + runTime + "]");

         pgeMetadata.replaceMetadata(PGE_RUNTIME, Long.toString(runTime));

      } catch (Exception e) {
         throw new Exception("Exception when executing PGE commands '"
               + (sf != null ? sf.getCommands() : "NULL") + "' : "
               + e.getMessage(), e);
      }
   }
View Full Code Here

   }

   protected ScriptFile buildPgeRunScript() {
      logger.fine("Creating PGE run script for shell [" + pgeConfig.getShellType()
                  + "] with contents " + pgeConfig.getExeCmds());
      ScriptFile sf = new ScriptFile(pgeConfig.getShellType());
      sf.setCommands(pgeConfig.getExeCmds());
      return sf;
   }
View Full Code Here

      logger.fine("Generated script file name [" + pgeScriptName + "]");
      return pgeScriptName;
   }

   protected void runPge() throws Exception {
      ScriptFile sf = null;
      try {
         long startTime = System.currentTimeMillis();
         logger.info("PGE start time [" + new Date(startTime) + "]");

         // create script to run
         sf = buildPgeRunScript();
         sf.writeScriptFile(getScriptPath().getAbsolutePath());

         // run script and evaluate whether success or failure
         updateStatus(RUNNING_PGE.getWorkflowStatusName());
         logger.info("Starting execution of PGE...");
         if (!wasPgeSuccessful(ExecUtils.callProgram(
               pgeConfig.getShellType() + " " + getScriptPath(), logger,
               new File(pgeConfig.getExeDir()).getAbsoluteFile()))) {
            throw new RuntimeException("Pge didn't finish successfully");
         } else {
            logger.info(
                  "Successfully completed running: '" + sf.getCommands() + "'");
         }

         long endTime = System.currentTimeMillis();
         logger.info("PGE end time [" + new Date(startTime) + "]");

         long runTime = endTime - startTime;
         logger.info("PGE runtime in millis [" + runTime + "]");

         pgeMetadata.replaceMetadata(PGE_RUNTIME, Long.toString(runTime));

      } catch (Exception e) {
         throw new Exception("Exception when executing PGE commands '"
               + (sf != null ? sf.getCommands() : "NULL") + "' : "
               + e.getMessage(), e);
      }
   }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.workflow.util.ScriptFile

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.