LUCENE-945: tests failed to find data dirs. Added sys-prop benchmark.work.dir and cfg-prop work.dir.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@551077 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doron Cohen 2007-06-27 06:49:38 +00:00
parent e6c659269a
commit d9b6aa9c0b
8 changed files with 46 additions and 14 deletions

View File

@ -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"/>

View File

@ -5,8 +5,9 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety
$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.

View File

@ -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>

View File

@ -48,6 +48,8 @@ import org.apache.lucene.benchmark.byTask.utils.FileUtils;
* <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 @@ public class PerfRunData {
// 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);

View File

@ -31,11 +31,11 @@ import java.util.Locale;
/**
* 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 class ReutersDocMaker extends BasicDocMaker {
*/
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) {

View File

@ -36,6 +36,11 @@ import org.apache.lucene.benchmark.byTask.utils.Config;
/**
* 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 class TrecDocMaker extends BasicDocMaker {
*/
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());

View File

@ -506,6 +506,11 @@ Here is a list of currently defined properties:
</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

View File

@ -29,9 +29,17 @@ import java.util.StringTokenizer;
/**
* 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 @@ public class Config {
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();
}