public abstract class AbstractPbsParser extends BatchParser implements uk.ac.ed.epcc.webapp.Contexed, PropertyContainerParser
Abstract Parser for variants of the PBS (Portable Batch System) records.
PBS uses a meta-format which is extensible using name-value pairs of attributes.
these attributes can in turn have complex structure that may generate multiple
properties so each attribute is processed by a ContainerEntryMaker.
This class defines the subset of common properties that are common to most PBS versions but will need
to be extended to parse a usable set of properties.
An instance of this parser will only parse certain record types. For all
other record types, the parse will throw a SkipRecord exception.
Which types are parsed and which are skipped is determined by the
mode of this parser. The mode takes the form of a comma separated
list of record types the parser can parse. This is set as a property in the
ConfigService stored in the AppContext used to
construct the PbsParser. During initialisation, a
PbsParser looks for the following property:
pbs.recordTypes.table_name = comma,separated,type,list
for example
pbs.recordTypes.PBSReservation = B
All record types in the list will be parsed. All other record types will be skipped. If the property isn't found, record type E is assumed.
ACCOUNT_PROP, batch, BATCH_SCRIPT_PROP, CPU_WAIT_PROP, EXPECTED_FINISH, JOB_ID_PROP, JOB_NAME_PROP, NODE_COUNT_PROP, PARTITION_PROP, PROC_COUNT_PROP, QUEUE_PROP, REQUEST_ACCURACY_PROP, REQUESTED_CPUS_PROP, REQUESTED_WALLCLOCK_PROP, RESIDENCY_PROP, SERIAL_PROP, SLOWDOWN_PROP, SUBJOB_PROP, SUBMITTED_PROP, SUBMITTED_TIMESTAMP, SUCCESS_PROP, TIME_PROP, WAIT_PROP, WALLCLOCK_PROPDUPLICATE_KEY| Constructor and Description |
|---|
AbstractPbsParser(uk.ac.ed.epcc.webapp.AppContext context)
Constructs a new
PbsParser. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
endParse()
End a batch parse this de-allocates any temporary storage and
and perform any final operations.
|
uk.ac.ed.epcc.webapp.AppContext |
getContext() |
PropExpressionMap |
getDerivedProperties(PropExpressionMap previous)
return a set of derived property definitions.
|
protected ContainerEntryMaker |
getEntryMaker(java.lang.String attr) |
PropertyFinder |
initFinder(uk.ac.ed.epcc.webapp.AppContext ctx,
PropertyFinder prev,
java.lang.String mode)
Generate a PropertyFinder that will find any PropertyTag generated by this class.
|
boolean |
parse(PropertyMap pbsMap,
java.lang.String record)
Parse a String representation of the UsageRecord.
|
void |
startParse(PropertyContainer defaults)
Start a batch parse.
|
readDouble, readInteger, readLong, readTimegetDefaultUniqueProperties, modifyDefaultTableSpecification, splitRecords, uniqueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDefaultUniqueProperties, splitRecordsmodifyDefaultTableSpecification@AutoTable(unique=true) public static final PropertyTag<java.util.Date> PBS_ENDED_PROP
@AutoTable public static final PropertyTag<java.lang.Integer> PBS_EXIT_PROP
@AutoTable(length=128) public static final PropertyTag<java.lang.String> PBS_GROUP_PROP
@AutoTable public static final PropertyTag<java.util.Date> PBS_STARTED_PROP
@AutoTable public static final PropertyTag<java.lang.String> PBS_USER_PROP
@AutoTable(length=128) public static final PropertyTag<java.lang.String> PBS_ACCOUNT_PROP
@AutoTable(unique=true, length=128) public static final PropertyTag<java.lang.String> PBS_ID_STRING_PROP
@AutoTable(length=128) public static final PropertyTag<java.lang.String> PBS_JOB_NAME_PROP
@AutoTable public static final PropertyTag<java.lang.String> PBS_QUEUE_PROP
@AutoTable public static final PropertyTag<java.util.Date> PBS_SUBMITTED_PROP
@AutoTable public static final PropertyTag<java.lang.String> PBS_ACCOUNTING_ID_PROP
@OptionalTable public static final PropertyTag<java.lang.String> PBS_ALTERNATE_ID_PROP
@OptionalTable(length=512) public static final PropertyTag<java.lang.String> PBS_AUTHORIZED_USERS_PROP
@OptionalTable(length=512) public static final PropertyTag<java.lang.String> PBS_AUTHORIZED_GROUPS_PROP
@OptionalTable(length=1024) public static final PropertyTag<java.lang.String> PBS_AUTHORIZED_HOSTS_PROP
@OptionalTable public static final PropertyTag<java.util.Date> PBS_ELIGIBLE_TIME_PROP
@OptionalTable public static final PropertyTag<java.util.Date> PBS_ENTERED_QUEUE_PROP
@OptionalTable(length=1024) public static final PropertyTag<java.lang.String> PBS_EXEC_HOST_PROP
@OptionalTable public static final PropertyTag<java.util.Date> PBS_JOB_TIMESTAMP_PROP
@OptionalTable(length=128) public static final PropertyTag<java.lang.String> PBS_OWNER_PROP
@OptionalTable(length=1) public static final PropertyTag<java.lang.String> PBS_RECORD_TYPE_PROP
@OptionalTable(target=java.lang.Long.class) public static final PropertyTag<java.lang.Number> PBS_RESERVATION_DURATION_PROP
@OptionalTable public static final PropertyTag<java.lang.String> PBS_RESERVATION_NAME_PROP
public static final PropertyTag<java.lang.String> PBS_RESERVATION_ID_PROP
@OptionalTable public static final PropertyTag<java.lang.Number> PBS_SESSION_PROP
@AutoTable public static final PropertyTag<java.lang.Number> PBS_TIME_USED_PROP
public AbstractPbsParser(uk.ac.ed.epcc.webapp.AppContext context)
PbsParser. The parser should not be used
until it's initFinder(AppContext, PropertyFinder, String) method
has been called.context - The context in which this parser is operatingpublic uk.ac.ed.epcc.webapp.AppContext getContext()
getContext in interface uk.ac.ed.epcc.webapp.Contexedpublic java.lang.String endParse()
PropertyContainerUpdaterendParse in interface PropertyContainerUpdaterendParse in class AbstractPropertyContainerUpdaterpublic PropExpressionMap getDerivedProperties(PropExpressionMap previous)
PropertyContainerUpdaterDefinitions are allowed for properties that are also generated directly in the parse phase. In this case the parse value should always be used by preference and the derived definition only provides a fall-back implementation if the parse value is unavailable. For example if not persisted in the database layer. This allows one parser/policy to specify a default implementation as a derived property definition which is then overridden by having the same property generated in a parse method of a different policy/parser
getDerivedProperties in interface PropertyContainerUpdatergetDerivedProperties in class BatchParserprevious - Previous definitionspublic PropertyFinder initFinder(uk.ac.ed.epcc.webapp.AppContext ctx, PropertyFinder prev, java.lang.String mode)
PropertyContainerUpdaterAll properties defined at run-time should have their PropertyTag objects constructed by the time the first call to this method returns. As some parsers properties will generate different things depending on the other properties already in scope this method is passed a PropertyFinder for any properties that may already be in scope. This will include any default parameters specified when the data was uploaded and any properties generated from the database meta-data. Though it is perfectly legal to return a PropertyFinder that returns a superset of the generated properties the only requirement is that the returned finder can find any property that this classes parse method may actually generate values for. So Normally the contents of the super-finder are not included in the result unless these values are actually generated by the parse. If values are generated then a MultiFinder can be populated with the PropertyRegistrys from the generated properties
initFinder in interface PropertyContainerUpdaterinitFinder in class BaseParserprev - PropertyFinder for the higher levels in the call chain.mode - String name of the destination table in case per-table customisation is neededpublic void startParse(PropertyContainer defaults)
PropertyContainerUpdaterstartParse in interface PropertyContainerUpdaterstartParse in class AbstractPropertyContainerUpdaterdefaults - properties constant for this accounting run.protected ContainerEntryMaker getEntryMaker(java.lang.String attr)
public boolean parse(PropertyMap pbsMap, java.lang.String record) throws AccountingParseException
PropertyContainerParserparse in interface PropertyContainerParserAccountingParseExceptionpbsMap - PropertyMap to add quantities