| Line | Hits | Source |
|---|---|---|
| 1 | package umich.cac.pbs; | |
| 2 | ||
| 3 | import java.util.logging.Logger; | |
| 4 | ||
| 5 | import umich.cac.data.Field; | |
| 6 | import umich.cac.data.FieldName; | |
| 7 | import umich.cac.data.FieldType; | |
| 8 | ||
| 9 | /** | |
| 10 | * Process the B record, "B" record in PBSPro | |
| 11 | * <p> | |
| 12 | * Still need to find the purpose of this record | |
| 13 | * <p> | |
| 14 | * This option is specific to PBSPro, on linux | |
| 15 | * | |
| 16 | * An example from PBS accounting file is below | |
| 17 | * | |
| 18 | * <pre> | |
| 19 | * 10:00:00;B;R1570.hypnos;owner=msbritt@hypnos queue=R1570 ctime=1049144464 start=1049468400 end=1049724000 duration=255600 nodes=node075m/0+node074m/0+node072m/0+node071m/0+node070m/0+node069m/0+node067m/0+node065m/0+node063m/0+node062m/0+node060m/0+node059m/0+node058m/0+node057m/0+node056m/0+node055m/0+node054m/0+node053m/0+node052m/0+node051m/0+node050m/0+node049m/0+node048m/0+node047m/0+node046m/0+node045m/0+node044m/0+node043m/0+node042m/0+node041m/0+node040m/0+node039m/0+node038m/0+node037m/0+node036m/0+node035m/0+node034m/0+node033m/0+node032m/0+node031m/0+node030m/0+node029m/0+node027m/0+node026m/0+node025m/0+node024m/0+node023m/0+node022m/0+node021m/0+node020m/0+node019m/0+node017m/0+node016m/0+node015m/0+node014m/0+node013m/0+node010m/0+node009m/0+node008m/0+node007m/0+node005m/0+node004m/0+node003m/0+node002m/0+node001m/0 Authorized_Users=msbritt@hypnos Resource_List.ncpu! s=65 Resource_List.neednodes=65 Resource_List.nodect=65 Resource_List.nodes=65 Resource_List.walltime=71:00:00 | |
| 20 | * </pre> | |
| 21 | * | |
| 22 | * @author rmach@umich.edu | |
| 23 | * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/BRecord.java,v 1.3 2003/10/21 19:39:02 rodmach Exp $ | |
| 24 | */ | |
| 25 | ||
| 26 | 3 | public class BRecord implements PbsRecordParser { |
| 27 | ||
| 28 | ||
| 29 | /** | |
| 30 | * Logger instance | |
| 31 | */ | |
| 32 | ||
| 33 | 6 | private Logger logger = Logger.getLogger(BRecord.class.getName()); |
| 34 | ||
| 35 | /** | |
| 36 | * Return the XML representation of an B record, inside <b_record> | |
| 37 | * tags. | |
| 38 | * <p> | |
| 39 | * | |
| 40 | * @param rawfields | |
| 41 | * Array from PBS containing the B record | |
| 42 | * @return The B record converted to XML | |
| 43 | */ | |
| 44 | ||
| 45 | public String processRecord(String[] rawfields) { | |
| 46 | ||
| 47 | //This field | |
| 48 | 0 | Field bField = |
| 49 | new Field(FieldName.B_FIELD, "b_record", FieldType.GENERIC); | |
| 50 | ||
| 51 | //Looks like B record is a "requested" type record | |
| 52 | 0 | Field resourceListField = |
| 53 | new Field( | |
| 54 | FieldName.RESOURCE_LIST, | |
| 55 | "resource_list", | |
| 56 | FieldType.RESOURCE_LIST); | |
| 57 | ||
| 58 | //The JOB ID | |
| 59 | 0 | Field jobIdField = |
| 60 | FieldFactory.getInstance().getField( | |
| 61 | FieldName.JOBID, | |
| 62 | rawfields[RecordPosition.JOB_ID]); | |
| 63 | 0 | bField.addChild(jobIdField); |
| 64 | ||
| 65 | //The DATE | |
| 66 | 0 | Field dateField = |
| 67 | FieldFactory.getInstance().getField( | |
| 68 | FieldName.DATE, | |
| 69 | rawfields[RecordPosition.DATE_TIME]); | |
| 70 | 0 | bField.addChild(dateField); |
| 71 | ||
| 72 | //Split message area that is space seperated string into an array. | |
| 73 | 0 | String[] fields = rawfields[RecordPosition.MESSAGE_AREA].split(" "); |
| 74 | ||
| 75 | //PBS encodes in FIELD=VALUE pairs | |
| 76 | 0 | int FIELD_NAME = 0; |
| 77 | 0 | int FIELD_VALUE = 1; |
| 78 | ||
| 79 | 0 | String fieldName = ""; |
| 80 | 0 | String fieldValue = ""; |
| 81 | ||
| 82 | //Go through all the fields, querying FieldFactory for fields | |
| 83 | ||
| 84 | 0 | for (int i = 0; i < fields.length; i++) { |
| 85 | ||
| 86 | 0 | String[] hashPair = fields[i].split("="); |
| 87 | ||
| 88 | 0 | fieldName = hashPair[FIELD_NAME]; |
| 89 | 0 | fieldValue = hashPair[FIELD_VALUE]; |
| 90 | ||
| 91 | 0 | Field theField = |
| 92 | FieldFactory.getInstance().getField(fieldName, fieldValue); | |
| 93 | ||
| 94 | /* | |
| 95 | * Combine the Fields returned by the FieldFactory based on the | |
| 96 | * type of Field it is (listed resource, or generic) | |
| 97 | */ | |
| 98 | ||
| 99 | 0 | if (theField.getFieldType() == FieldType.RESOURCE_LIST) { |
| 100 | ||
| 101 | 0 | resourceListField.addChild(theField); |
| 102 | ||
| 103 | 0 | } else if (theField.getFieldType() == FieldType.GENERIC) { |
| 104 | ||
| 105 | 0 | bField.addChild(theField); |
| 106 | ||
| 107 | } else { | |
| 108 | ||
| 109 | //Do nothing, only care about above fields | |
| 110 | ||
| 111 | } | |
| 112 | ||
| 113 | } | |
| 114 | ||
| 115 | 0 | bField.addChild(resourceListField); |
| 116 | ||
| 117 | 0 | return bField.toXML(); |
| 118 | ||
| 119 | } | |
| 120 | ||
| 121 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |