jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.job
Class JobUtils

java.lang.Object
  extended by cedar.jetweb.job.JobUtils

public abstract class JobUtils
extends java.lang.Object

Utilities for job submission.

Author:
Jon Butterworth

Constructor Summary
JobUtils()
           
 
Method Summary
static int countCompletedJobs(java.lang.String batchNum)
          Return the number of jobs completed by the given batch number.
static int countJobs(java.lang.String batchNum)
          Return the number of jobs submitted to the given batch number.
static void doJobRequest(ResultSearchPattern pattern, java.util.Vector processList, java.io.PrintWriter out, java.lang.String servletPath, java.lang.String requestingHost)
          Try to build a JobRequest, and if it works, submit it.
static java.util.Vector<Model> getNewData(java.io.File root)
          Performs recursive search of directories below root for completed batch jobs.
static boolean isValidLogName(java.lang.String name)
          Test whether the input String is a valid name for a logfile.
static void makeCards(JobRequest jreq)
          Class method to make a set of control cards based upon a JobRequest.
static void makeScript(java.lang.String scriptname, Generator gen)
          Class method to make a job script.
static boolean moveAndStore(LogFile log)
          Move histogram and log files from run directory to data directory.
static void moveLogs(java.util.Enumeration logs, java.lang.String newDir)
          Move all LogFiles in the given Enumeration to the directory given by the input String.
static void removeBadPoints(PredictedPlot plot, LogFile log)
          Set points to zero for runs with known bugs.
static java.util.Enumeration selectPendingJobs()
          Return the number of pending jobs completed by the given batch number.
static int submit(JobRequest jreq)
          Submit this job.
static void updateJobs()
          Look for recently completed jobs in the run area and add them to the database.
static java.lang.String zipIt(java.lang.String name)
          See whether the input file is already a zipped name (gzip) and if not, zip it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobUtils

public JobUtils()
Method Detail

updateJobs

public static void updateJobs()
                       throws JetWebException
Look for recently completed jobs in the run area and add them to the database.

Throws:
JetWebException


doJobRequest

public static void doJobRequest(ResultSearchPattern pattern,
                                java.util.Vector processList,
                                java.io.PrintWriter out,
                                java.lang.String servletPath,
                                java.lang.String requestingHost)
                         throws JetWebException
Try to build a JobRequest, and if it works, submit it.

Throws:
JetWebException


makeCards

public static void makeCards(JobRequest jreq)
                      throws JetWebException
Class method to make a set of control cards based upon a JobRequest. Will create the directory for the cards to go in if necessary. The actual card writing itself is passed over to the Generator class.

Parameters:
JobRequest -
Throws:
JetWebException


makeScript

public static void makeScript(java.lang.String scriptname,
                              Generator gen)
                       throws JetWebException
Class method to make a job script. Will create the directory for the script to go in if necessary.

Parameters:
scriptname - full path+name of the card file (excluding .input) to be built.
Throws:
JetWebException


moveLogs

public static void moveLogs(java.util.Enumeration logs,
                            java.lang.String newDir)
Move all LogFiles in the given Enumeration to the directory given by the input String.


isValidLogName

public static boolean isValidLogName(java.lang.String name)
Test whether the input String is a valid name for a logfile.


zipIt

public static java.lang.String zipIt(java.lang.String name)
                              throws JetWebException
See whether the input file is already a zipped name (gzip) and if not, zip it. Return the name of the zipped file.

Throws:
JetWebException


removeBadPoints

public static void removeBadPoints(PredictedPlot plot,
                                   LogFile log)
                            throws JetWebException
Set points to zero for runs with known bugs.

Throws:
JetWebException


countJobs

public static int countJobs(java.lang.String batchNum)
                     throws JetWebException
Return the number of jobs submitted to the given batch number.

Throws:
JetWebException


countCompletedJobs

public static int countCompletedJobs(java.lang.String batchNum)
                              throws JetWebException
Return the number of jobs completed by the given batch number.

Throws:
JetWebException


selectPendingJobs

public static java.util.Enumeration selectPendingJobs()
                                               throws JetWebException
Return the number of pending jobs completed by the given batch number.

Throws:
JetWebException


submit

public static int submit(JobRequest jreq)
Submit this job. This method copies run script to the spool area for submission, rather than submitting them directly.

Returns:
outcome code
    • 0 is Ok
      1 invalid jobrequest
      2 user does not have privilege
      3 some other problem

  • moveAndStore

    public static boolean moveAndStore(LogFile log)
                                throws JetWebException
    Move histogram and log files from run directory to data directory. Return true if successful.

    Parameters:
    log - file to be moved
    Throws:
    JetWebException


    getNewData

    public static java.util.Vector<Model> getNewData(java.io.File root)
                                              throws JetWebException
    Performs recursive search of directories below root for completed batch jobs. Adds any new data found to the database. Returns a list of all models affected by these new data. Logiles should have a valid name, and should also have an associated .rz file.

    Parameters:
    root - the root directory in the filesystem where new data is stored. Search recursively below this for new data.
    Returns:
    a vector of ids of the affected models (Integers)
    Throws:
    JetWebException