jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.job
Class LogFile

java.lang.Object
  extended by cedar.jetweb.job.LogFile
All Implemented Interfaces:
Storeable

public class LogFile
extends java.lang.Object
implements Storeable

Representation of a log file from a single Monte Carlo batch job.

Version:
$Date: 2006-06-20 11:01:14 +0100 (Tue, 20 Jun 2006) $ $Revision: 1194 $
Author:
Jon Butterworth

Field Summary
static int COMPLETED
          LogFile job already in db, data already used
static int ERROR
          An error occurred during processing.
static java.lang.String NANSTR
           
static java.lang.String PHPDF
          parameter name constant
static java.lang.String PRPDF
          parameter name constant
static int RUN
          LogFile job just completed, data to be added to runSeries.
static int SUBMITTED
          LogFile job was submitted but not complete yet.
static int UNDEFINED
          LogFile job in undefined state.
 
Constructor Summary
LogFile(RunSeries lp)
          Do nothing constructor.
LogFile(java.lang.String name)
          Create a new LogFile.
 
Method Summary
 void checkStatus()
          Works out the status of this LogFile and sets it.
static java.lang.String decodePhotonPDFLIB(java.lang.String set, java.lang.Integer member)
          Convert to Photon PDFLIB settings to LHAPDF-like name-member format for storage.
static java.lang.String decodeProtonPDFLIB(java.lang.String set, java.lang.Integer member)
          Convert to Proton PDFLIB settings to LHAPDF file-member format for storage.
 void doChecks()
          Make consistency checks on parameters.
 java.io.File getFile()
          Get the file.
 Generator getGenerator()
           
 int getId()
          Get the unique ID of the LogFile.
 double getLumi()
          Get the integrated luminosity for this logfile.
 RunSeries getRunSeries()
          Get the associated RunSeries.
 int getStatus()
          Get the status for the LogFile.
 java.lang.String getStem()
          Get the LogFile stem.
 java.lang.String getXmlFileName()
          Get the LogFile xml file.
 boolean hasRzFile()
          Tests whether .rz file exists.
 boolean isValid()
          Check whether this is a valid LogFile.
 boolean retrieve()
          Populate the object in memory from the database.
 void setFile(java.io.File f)
          Set the actual file associated with this LogFile.
 void setGenerator(Generator gen)
           
 void setId(int i)
          Set the unique ID of the LogFile.
 void setLumi(double l)
          Set the integrated luminosity for this logfile.
 void setRunSeries(RunSeries newrs)
          Set the associated RunSeries
 void setRunSeriesId(int inew)
          Set the associated RunSeries id.
 void setStatus(int i)
          Set Job Status: must be one of LogFile.UNDEFINED LogFile.SUBMITTED LogFile.RUN LogFile.COMPLETED
 void setValid(boolean b)
           
 void setXmlFile(java.lang.String path)
           
 boolean store()
          Save the LogFile in the Database.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
LogFile job in undefined state.

See Also:
Constant Field Values


SUBMITTED

public static final int SUBMITTED
LogFile job was submitted but not complete yet.

See Also:
Constant Field Values


RUN

public static final int RUN
LogFile job just completed, data to be added to runSeries.

See Also:
Constant Field Values


COMPLETED

public static final int COMPLETED
LogFile job already in db, data already used

See Also:
Constant Field Values


ERROR

public static final int ERROR
An error occurred during processing. Data in a semi-saved state.

See Also:
Constant Field Values


NANSTR

public static final java.lang.String NANSTR
See Also:
Constant Field Values

PHPDF

public static final java.lang.String PHPDF
parameter name constant

See Also:
Constant Field Values


PRPDF

public static final java.lang.String PRPDF
parameter name constant

See Also:
Constant Field Values

Constructor Detail

LogFile

public LogFile(RunSeries lp)
Do nothing constructor. This constructor does not populate any of the fields of the LogFile except for the associated RunSeries, which is the input argument.


LogFile

public LogFile(java.lang.String name)
        throws JetWebException
Create a new LogFile. Looks in the DB logfile table to see if a file with this name exists. If it does, obtains the status & validity.

Parameters:
name - String containing the absolute name+path of the logfile on the server.
Throws:
JetWebException

Method Detail

retrieve

public boolean retrieve()
                 throws JetWebException
Description copied from interface: Storeable
Populate the object in memory from the database. Return true if the information retrieved is up to date.

Specified by:
retrieve in interface Storeable
Throws:
JetWebException


store

public boolean store()
              throws JetWebException
Save the LogFile in the Database. Find the row in the runSeries table which matches them (and create one if none does). If no row exists in the logfile table, create one pointing to this row in the runSeries table. If a row exists, set the status bit to "completed". Make the plots for this logfile from the xml. Get the points from the predicted_point table which go with the runSeries row, and add the points from this logfile to them. (Create the predicted_point if they don't already exist.

Specified by:
store in interface Storeable
Returns:
true if the object was inserted, false otherwise.
Throws:
JetWebException


getFile

public java.io.File getFile()
Get the file.

Returns:
the log file of this Monte Carlo run.


setFile

public void setFile(java.io.File f)
Set the actual file associated with this LogFile.

Parameters:
set - the log file of this Monte Carlo run.


getId

public int getId()
Get the unique ID of the LogFile.

Specified by:
getId in interface Storeable
Returns:
-1 if undefined.


getStatus

public int getStatus()
Get the status for the LogFile.

Returns:
  • UNDEFINED
  • SUBMITTED
  • RUN
  • COMPLETED
See Also:
UNDEFINED, SUBMITTED, RUN, COMPLETED


getRunSeries

public RunSeries getRunSeries()
                       throws JetWebException
Get the associated RunSeries.

Returns:
runSeries contains all the parameters associated with this run.
Throws:
JetWebException


getGenerator

public Generator getGenerator()
                       throws JetWebException
Throws:
JetWebException
See Also:
RunSeries.getGenerator()

setRunSeriesId

public void setRunSeriesId(int inew)
Set the associated RunSeries id.

Parameters:
runSeriesId - unique id of runseries which contains all the parameters associated with this run.


setRunSeries

public void setRunSeries(RunSeries newrs)
Set the associated RunSeries

Parameters:
runSeries - contains all the parameters associated with this run.


setId

public void setId(int i)
Set the unique ID of the LogFile.

Parameters:
id -


setStatus

public void setStatus(int i)
               throws JetWebException
Set Job Status: must be one of

Throws:
JetWebException
See Also:
UNDEFINED, SUBMITTED, RUN, COMPLETED


setGenerator

public void setGenerator(Generator gen)
                  throws JetWebException
Throws:
JetWebException
See Also:
RunSeries.getGenerator()

setLumi

public void setLumi(double l)
Set the integrated luminosity for this logfile.

Parameters:
l - is the new luminosity value to be set.


getLumi

public double getLumi()
Get the integrated luminosity for this logfile.


doChecks

public void doChecks()
              throws JetWebException
Make consistency checks on parameters.

Throws:
JetWebException


getStem

public java.lang.String getStem()
Get the LogFile stem.

Returns:
the path for this logfile (relative to app. root) without the trailing oXXXX.gz


getXmlFileName

public java.lang.String getXmlFileName()
Get the LogFile xml file.

Returns:
xml filename, including path rel to app. root.


setXmlFile

public void setXmlFile(java.lang.String path)

hasRzFile

public boolean hasRzFile()
Tests whether .rz file exists.

Returns:
boolean exists.


isValid

public boolean isValid()
Check whether this is a valid LogFile.

Returns:
true if the batch job terminated properly and its parameters could be read.


setValid

public void setValid(boolean b)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

checkStatus

public void checkStatus()
                 throws JetWebException
Works out the status of this LogFile and sets it.

Throws:
JetWebException


decodeProtonPDFLIB

public static java.lang.String decodeProtonPDFLIB(java.lang.String set,
                                                  java.lang.Integer member)
                                           throws JetWebException
Convert to Proton PDFLIB settings to LHAPDF file-member format for storage.

Throws:
JetWebException


decodePhotonPDFLIB

public static java.lang.String decodePhotonPDFLIB(java.lang.String set,
                                                  java.lang.Integer member)
                                           throws JetWebException
Convert to Photon PDFLIB settings to LHAPDF-like name-member format for storage.

Throws:
JetWebException