lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dor...@apache.org
Subject svn commit: r551077 - in /lucene/java/trunk: ./ contrib/benchmark/ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ contrib/benchmark/src/java/org/apache/lucene/benchmar...
Date Wed, 27 Jun 2007 06:49:39 GMT
Author: doronc
Date: Tue Jun 26 23:49:38 2007
New Revision: 551077

URL: http://svn.apache.org/viewvc?view=rev&rev=551077
Log:
LUCENE-945: tests failed to find data dirs. Added sys-prop benchmark.work.dir and cfg-prop
work.dir.

Modified:
    lucene/java/trunk/common-build.xml
    lucene/java/trunk/contrib/benchmark/CHANGES.txt
    lucene/java/trunk/contrib/benchmark/build.xml
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersDocMaker.java
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocMaker.java
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java

Modified: lucene/java/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/common-build.xml?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/common-build.xml (original)
+++ lucene/java/trunk/common-build.xml Tue Jun 26 23:49:38 2007
@@ -310,8 +310,9 @@
       <sysproperty key="docs.dir" file="src/test"/>
       <sysproperty key="index.dir" file="${build.dir}/test/index"/>
 
-      <!-- contrib/benchmark uses this system property to locate defined tasks -->
+      <!-- contrib/benchmark uses this system property to locate docs data and defined
tasks -->
       <sysproperty key="tasks.dir" file="${build.dir}/classes/java/org/apache/lucene/benchmark/byTask/tasks"/>
+      <sysproperty key="benchmark.work.dir" file="${common.dir}/contrib/benchmark/work"/>
 
       <formatter type="xml"/>
       <formatter type="brief" usefile="false"/>

Modified: lucene/java/trunk/contrib/benchmark/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/CHANGES.txt?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/CHANGES.txt (original)
+++ lucene/java/trunk/contrib/benchmark/CHANGES.txt Tue Jun 26 23:49:38 2007
@@ -5,8 +5,9 @@
 $Id:$
 
 6/25/07
-- LUCENE-940: Multi-threaded issues fixed: SimpleDateFormat; 
-  logging for addDoc/deleteDoc tasks. (Doron Cohen)
+- LUCENE-940: Multi-threaded issues fixed: SimpleDateFormat; logging for addDoc/deleteDoc
tasks.
+- LUCENE-945: tests fail to find data dirs. Added sys-prop benchmark.work.dir and cfg-prop
work.dir.
+(Doron Cohen)
 
 4/17/07
 - LUCENE-863: Deprecated StandardBenchmarker in favour of byTask code.

Modified: lucene/java/trunk/contrib/benchmark/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/build.xml?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/build.xml (original)
+++ lucene/java/trunk/contrib/benchmark/build.xml Tue Jun 26 23:49:38 2007
@@ -28,7 +28,6 @@
 
 
     <target name="check-files">
-
         <available file="temp/news20.tar.gz" property="news20.exists"/>
 
         <available file="${working.dir}/20_newsgroup" property="news20.expanded"/>
@@ -152,4 +151,9 @@
 
     <target name="init" depends="contrib-build.init,compile-demo,check-files"/>
 
+    <!-- make sure online collections (reuters) are first downloaded -->
+    <target name="test" depends="init,get-files">
+      <antcall target="common.test" inheritRefs="true" />
+    </target>
+    
 </project>

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
Tue Jun 26 23:49:38 2007
@@ -48,6 +48,8 @@
  *  <li>Analyzer.
  *  <li>Statistics data which updated during the run.
  * </ul>
+ * Config properties: work.dir=&lt;path to root of docs and index dirs| Default: work&gt;
+ * </ul>
  */
 public class PerfRunData {
 
@@ -117,7 +119,7 @@
     
     // directory (default is ram-dir).
     if ("FSDirectory".equals(config.get("directory","RAMDirectory"))) {
-      File workDir = new File("work");
+      File workDir = new File(config.get("work.dir","work"));
       File indexDir = new File(workDir,"index");
       if (eraseIndex && indexDir.exists()) {
         FileUtils.fullyDelete(indexDir);

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersDocMaker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersDocMaker.java?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersDocMaker.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersDocMaker.java
Tue Jun 26 23:49:38 2007
@@ -31,11 +31,11 @@
 
 /**
  * A DocMaker using the Reuters collection for its input.
- *
- * Config properties:
- * docs.dir=&lt;path to the docs dir| Default: reuters-out&gt;
-
- *
+ * <p>
+ * Config properties:<ul>
+ * <li>work.dir=&lt;path to the root of docs and indexes dirs| Default: work&gt;</li>
+ * <li>docs.dir=&lt;path to the docs dir| Default: reuters-out&gt;</li>
+ * </ul>
  */
 public class ReutersDocMaker extends BasicDocMaker {
 
@@ -50,9 +50,9 @@
    */
   public void setConfig(Config config) {
     super.setConfig(config);
+    File workDir = new File(config.get("work.dir","work"));
     String d = config.get("docs.dir","reuters-out");
-    dataDir = new File(new File("work"),d);
-
+    dataDir = new File(workDir,d);
 
     collectFiles(dataDir,inputFiles);
     if (inputFiles.size()==0) {

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocMaker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocMaker.java?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocMaker.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecDocMaker.java
Tue Jun 26 23:49:38 2007
@@ -36,6 +36,11 @@
 
 /**
  * A DocMaker using the (compressed) Trec collection for its input.
+ * <p>
+ * Config properties:<ul>
+ * <li>work.dir=&lt;path to the root of docs and indexes dirs| Default: work&gt;</li>
+ * <li>docs.dir=&lt;path to the docs dir| Default: trec&gt;</li>
+ * </ul>
  */
 public class TrecDocMaker extends BasicDocMaker {
 
@@ -61,8 +66,9 @@
    */
   public void setConfig(Config config) {
     super.setConfig(config);
+    File workDir = new File(config.get("work.dir","work"));
     String d = config.get("docs.dir","trec");
-    dataDir = new File(new File("work"),d);
+    dataDir = new File(workDir,d);
     collectFiles(dataDir,inputFiles);
     if (inputFiles.size()==0) {
       throw new RuntimeException("No txt files in dataDir: "+dataDir.getAbsolutePath());

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html
Tue Jun 26 23:49:38 2007
@@ -506,6 +506,11 @@
 </p>
 <ol>
 
+  <li><b>Root directory for data and indexes:</b></li>
+    <ul><li>work.dir (default is System property "benchmark.work.dir" or "work".)
+    </li></ul>
+  </li>
+
   <li><b>Docs and queries creation:</b></li>
     <ul><li>analyzer
     </li><li>doc.maker

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java?view=diff&rev=551077&r1=551076&r2=551077
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
Tue Jun 26 23:49:38 2007
@@ -29,9 +29,17 @@
 
 /**
  * Perf run configuration properties.
+ * <p>
  * Numeric peroperty containing ":", e.g. "10:100:5" is interpreted 
  * as array of numeric values. It is extracted once, on first use, and 
- * maintain an round number to return the appropriate value.   
+ * maintain a round number to return the appropriate value.
+ * <p>
+ * The config property "work.dir" tells where is the root of 
+ * docs data dirs and indexes dirs. It is set to either of: <ul>
+ * <li>value supplied for it in the alg file;</li>
+ * <li>otherwise, value of System property "benchmark.work.dir";</li>
+ * <li>otherwise, "work".</li>
+ * </ul>
  */
 public class Config {
 
@@ -70,6 +78,11 @@
     this.props = new Properties();
     props.load(new ByteArrayInputStream(sb.toString().getBytes()));
 
+    // make sure work dir is set properly 
+    if (props.get("work.dir")==null) {
+      props.setProperty("work.dir",System.getProperty("benchmark.work.dir","work"));
+    }
+    
     if (Boolean.valueOf(props.getProperty("print.props","true")).booleanValue()) {
       printProps();
     }



Mime
View raw message