Changeset 69
- Timestamp:
- 05/03/16 15:17:36 (9 years ago)
- Location:
- trunk/CrossPare/src/de/ugoe/cs/cpdp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/Runner.java
r41 r69 45 45 public static void main(String[] args) { 46 46 new TextConsole(Level.FINE); 47 final int concurrentThreads = Runtime.getRuntime().availableProcessors() - 2;47 final int concurrentThreads = Runtime.getRuntime().availableProcessors(); 48 48 final ExecutorService threadPool = Executors.newFixedThreadPool(concurrentThreads); 49 49 for (String arg : args) { … … 89 89 90 90 if (config != null) { 91 Console.trace(Level.FINE , config.toString());91 Console.trace(Level.FINEST, config.toString()); 92 92 // Instantiate the class like it was given as parameter in the config file and cast it 93 93 // to the interface -
trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/IResultStorage.java
r68 r69 4 4 5 5 public void addResult(ExperimentResult result); 6 7 public boolean containsResult(String experimentName, String productName); 6 8 } -
trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/MySQLResultStorage.java
r68 r69 4 4 import java.sql.Connection; 5 5 import java.sql.DriverManager; 6 import java.sql.ResultSet; 6 7 import java.sql.SQLException; 7 8 import java.sql.Statement; … … 34 35 35 36 public void addResult(ExperimentResult result) { 36 Statement stmt;37 try {38 stmt = con.createStatement();39 }40 catch (SQLException e) {41 Console.printerr("Problem with MySQL connection: ");42 Console.printerr("SQLException: " + e.getMessage());43 Console.printerr("SQLState: " + e.getSQLState());44 Console.printerr("VendorError: " + e.getErrorCode());45 return;46 }47 37 StringBuilder sql = new StringBuilder(); 48 38 sql.append("INSERT INTO crosspare.results VALUES (NULL,"); … … 72 62 sql.append(result.getTn()+","); 73 63 sql.append(result.getFp()+");"); 64 65 Statement stmt; 74 66 try { 67 stmt = con.createStatement(); 75 68 stmt.executeUpdate(sql.toString().replace("NaN", "NULL")); 76 69 } … … 84 77 } 85 78 86 //public boolean containsResult(String configurationName, String productName, String classifier); 79 @Override 80 public boolean containsResult(String experimentName, String productName) { 81 String sql = "SELECT COUNT(*) as cnt FROM crosspare.results WHERE configurationName=\'" + experimentName + "\' AND productName=\'" + productName + "\';"; 82 Statement stmt; 83 boolean contained = false; 84 try { 85 stmt = con.createStatement(); 86 ResultSet results = stmt.executeQuery(sql); 87 results.next(); 88 int count = results.getInt("cnt"); 89 contained = count>0; 90 } 91 catch (SQLException e) { 92 Console.printerr("Problem with MySQL connection: \n"); 93 Console.printerr("SQLException: " + e.getMessage() + "\n"); 94 Console.printerr("SQLState: " + e.getSQLState() + "\n"); 95 Console.printerr("VendorError: " + e.getErrorCode() + "\n"); 96 } 97 return contained; 98 } 87 99 } -
trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/AbstractCrossProjectExperiment.java
r68 r69 29 29 import de.ugoe.cs.cpdp.dataselection.ISetWiseDataselectionStrategy; 30 30 import de.ugoe.cs.cpdp.eval.IEvaluationStrategy; 31 import de.ugoe.cs.cpdp.eval.IResultStorage; 31 32 import de.ugoe.cs.cpdp.loader.IVersionLoader; 32 33 import de.ugoe.cs.cpdp.training.ISetWiseTestdataAwareTrainingStrategy; … … 163 164 config.getExperimentName(), versionCount, 164 165 testVersionCount, testVersion.getVersion())); 166 if (resultsAvailable(testVersion)) { 167 Console.traceln(Level.INFO, 168 String.format( 169 "[%s] [%02d/%02d] %s: results already available; skipped", 170 config.getExperimentName(), versionCount, 171 testVersionCount, testVersion.getVersion())); 172 versionCount++; 173 continue; 174 } 165 175 166 176 // Setup testdata and training data … … 299 309 config.getExperimentName() + ".csv"); 300 310 } 301 evaluator.apply(testdata, traindata, allTrainers, writeHeader, config.getResultStorages()); 311 evaluator.apply(testdata, traindata, allTrainers, writeHeader, 312 config.getResultStorages()); 302 313 writeHeader = false; 303 314 } … … 327 338 return result; 328 339 } 340 341 private boolean resultsAvailable(SoftwareVersion version) { 342 if (config.getResultStorages().isEmpty()) { 343 return false; 344 } 345 boolean available = true; 346 for (IResultStorage storage : config.getResultStorages()) { 347 available &= storage.containsResult(config.getExperimentName(), version.getVersion()); 348 } 349 return available; 350 } 329 351 }
Note: See TracChangeset
for help on using the changeset viewer.