- Timestamp:
- 02/26/13 08:41:50 (12 years ago)
- Location:
- DCWoRMS/branches/coolemall
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/simulator/workload/reader/archive/AbstractWAParser.java
r477 r883 32 32 protected HashMap<String, String> reverseIdMapping; // key - xmlJobId_xmlTaskId, value - swf job id 33 33 protected HashMap<String, Long> jobIndex; 34 protected HashMap<String, String> appMapping; 34 35 protected String fields[]; 35 36 protected int fieldsNo; … … 44 45 this.reverseIdMapping = new HashMap<String, String>(); 45 46 this.jobIndex = new HashMap<String, Long>(); 47 this.appMapping = new HashMap<String, String>(); 46 48 this.headerLoaded = false; 47 49 this.buildIndex = true; … … 144 146 } else if(label.equals(WAFields.COMMENT_IDMAPPING)){ 145 147 loadIDMapping(); 148 continue; 149 } else if(label.equals(WAFields.COMMENT_APPLICATION)){ 150 String [] valueData = value.split(" "); 151 String appId = valueData[0]; 152 String appName = valueData[1]; 153 appMapping.put(appId, appName); 146 154 continue; 147 155 } … … 285 293 return null; 286 294 } 295 296 297 public String getAppMapping(String appId) { 298 String appName = appMapping.get(appId); 299 return appName; 300 } 301 287 302 } -
DCWoRMS/branches/coolemall/src/simulator/workload/reader/archive/QcgWAJobReader.java
r477 r883 2 2 3 3 import java.io.IOException; 4 import java.io.StringReader; 4 5 import java.io.StringWriter; 5 6 import java.io.Writer; 7 import java.util.Map; 6 8 7 9 import org.exolab.castor.xml.MarshalException; 8 10 import org.exolab.castor.xml.Marshaller; 9 11 import org.exolab.castor.xml.ResolverException; 12 import org.exolab.castor.xml.Unmarshaller; 10 13 import org.exolab.castor.xml.ValidationException; 11 14 import org.exolab.castor.xml.XMLContext; … … 13 16 import simulator.workload.reader.archive.swf.SWFFields; 14 17 import org.qcg.broker.schemas.jobdesc.QcgJob; 18 import org.qcg.broker.schemas.jobdesc.ResourceConsumptionProfileType; 15 19 import org.qcg.broker.schemas.jobdesc.Task; 20 21 import dcworms.schedframe.scheduling.utils.JobDescription; 16 22 17 23 /** … … 25 31 protected String currntJobID; 26 32 protected Marshaller marshaller; 33 34 protected Unmarshaller unmarshaller; 27 35 28 36 public QcgWAJobReader(String fileName) throws NullPointerException, … … 42 50 context.addPackage("org.qcg.broker.schemas.jobdesc.QcgJob"); 43 51 this.marshaller = context.createMarshaller(); 52 unmarshaller = context.createUnmarshaller(); 44 53 } catch (ResolverException e) { 45 54 e.printStackTrace(); 46 55 this.marshaller = null; 56 unmarshaller = null; 47 57 } 48 58 } … … 100 110 } 101 111 112 public String mergeSwfAndXmlProfile( Map<String, JobDescription> jobProfilesMap, String swfJobDesc) throws IOException{ 113 114 StringReader reader = new StringReader(swfJobDesc); 115 QcgJob job = null; 116 try { 117 job = (QcgJob)unmarshaller.unmarshal(reader); 118 } catch (MarshalException e) { 119 // TODO Auto-generated catch block 120 e.printStackTrace(); 121 } catch (ValidationException e) { 122 // TODO Auto-generated catch block 123 e.printStackTrace(); 124 } 125 126 JobDescription xmlJobDescription = jobProfilesMap.get(job.getTask(0).getExecution().getExecutable().getApplication().getName()); 127 if(xmlJobDescription != null){ 128 Task patternTask = xmlJobDescription.getDescription().getTask(0); 129 if(patternTask != null){ 130 ResourceConsumptionProfileType rcp = patternTask.getExecution().getResourceConsumptionProfile(); 131 job.getTask(0).getExecution().setResourceConsumptionProfile(rcp); 132 } 133 } 134 135 Writer w = new StringWriter(); 136 try { 137 this.marshaller.setWriter(w); 138 this.marshaller.marshal(job); 139 } catch (MarshalException e) { 140 new IOException(e.getMessage()); 141 } catch (ValidationException e) { 142 new IOException(e.getMessage()); 143 } 144 return w.toString(); 145 } 102 146 } -
DCWoRMS/branches/coolemall/src/simulator/workload/reader/archive/WAParser.java
r477 r883 43 43 44 44 public int getType(); 45 46 public String getAppMapping(String appId); 45 47 } -
DCWoRMS/branches/coolemall/src/simulator/workload/reader/archive/swf/QcgSWFJobReader.java
r477 r883 1 1 package simulator.workload.reader.archive.swf; 2 2 3 import org.qcg.broker.schemas.jobdesc.Application; 3 4 import org.qcg.broker.schemas.jobdesc.ComputingResourceBaseTypeChoice; 4 5 import org.qcg.broker.schemas.jobdesc.ComputingResourceType; 5 6 import org.qcg.broker.schemas.jobdesc.ComputingResourceBaseTypeChoiceItem; 6 7 import org.qcg.broker.schemas.jobdesc.ComputingResourceParameterType; 8 import org.qcg.broker.schemas.jobdesc.Executable; 7 9 import org.qcg.broker.schemas.jobdesc.ExecutionTimeType; 10 import org.qcg.broker.schemas.jobdesc.ExecutionType; 8 11 import org.qcg.broker.schemas.jobdesc.ParameterTypeChoice; 9 12 import org.qcg.broker.schemas.jobdesc.ParameterTypeChoiceItem; … … 13 16 import org.qcg.broker.schemas.jobdesc.types.ComputingParameterName; 14 17 import org.qcg.broker.schemas.jobdesc.Task; 18 15 19 import java.io.IOException; 16 20 … … 20 24 21 25 import simulator.workload.reader.archive.QcgWAJobReader; 26 import test.workloadandapp.AppTypeGenerator; 22 27 23 28 … … 34 39 protected String currntJobID; 35 40 41 protected AppTypeGenerator appTypeGen; 42 36 43 public QcgSWFJobReader(String fileName) throws NullPointerException, 37 44 IOException { 38 45 super(fileName); 39 46 this.waParser.loadHeader(); 47 this.appTypeGen = new AppTypeGenerator(); 40 48 } 41 49 … … 75 83 if(value <= 0){ 76 84 if(log.isWarnEnabled()) 77 log.warn("Task "+data[0] + " is omit ed. Number of allocated processors should be grather then 0.");85 log.warn("Task "+data[0] + " is omitted. Number of allocated processors should be greater than 0."); 78 86 return null; 79 87 } … … 82 90 if(value <= 0){ 83 91 if(log.isWarnEnabled()) 84 log.warn("Task "+data[0] + " is omit ed. Number of requested processors should be grather then 0.");92 log.warn("Task "+data[0] + " is omitted. Number of requested processors should be greater than 0."); 85 93 return null; 86 94 } … … 89 97 if(value <= 0){ 90 98 if(log.isWarnEnabled()) 91 log.warn("Task "+data[0] + " is omit ed. Task runtime should be grather then 0.");99 log.warn("Task "+data[0] + " is omitted. Task runtime should be greater than 0."); 92 100 return null; 93 101 } … … 95 103 } 96 104 97 if (value == -1 ) continue;105 if (value == -1 && i != SWFFields.DATA_EXECUTABLE_NUMBER) continue; 98 106 99 107 } catch (NumberFormatException e) { … … 207 215 208 216 case SWFFields.DATA_EXECUTABLE_NUMBER: 217 String appName = waParser.getAppMapping(String.valueOf(value)); 218 if(appName == null){ 219 if(value != -1){ 220 appName = String.valueOf(value); 221 } else { 222 appName = appTypeGen.randomAppType(); 223 } 224 } 225 ExecutionType execType = new ExecutionType(); 226 Executable executable = new Executable(); 227 Application application = new Application(); 228 application.setName(appName); 229 executable.setApplication(application); 230 execType.setExecutable(executable); 231 task.setExecution(execType); 209 232 break; 210 233
Note: See TracChangeset
for help on using the changeset viewer.