Package org.intermine.task
Class PrecomputeTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.intermine.task.PrecomputeTask
-
public class PrecomputeTask extends org.apache.tools.ant.Task
A Task that reads a list of queries from a properties file (eg. testmodel_precompute.properties) and calls ObjectStoreInterMineImpl.precompute() using the Query.- Author:
- Kim Rutherford
-
-
Field Summary
Fields Modifier and Type Field Description protected int
minRows
protected java.lang.String
objectStoreAlias
protected java.lang.String
precomputePropertiesPath
protected static int
THREAD_COUNT
-
Constructor Summary
Constructors Constructor Description PrecomputeTask()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.util.List<Query>
constructQueries(boolean createAllOrders, ObjectStore os, java.lang.String path, java.lang.String precomputeKey)
Create queries for given path.void
execute()
protected ParallelPrecomputer
getPrecomputer(ObjectStoreInterMineImpl os)
Create a ParallelPrecomputer.void
precompute(boolean createAllOrders, ObjectStore os, int minRows)
Create precomputed tables for the given ObjectStore.void
setMinRows(java.lang.Integer minRows)
Set the minimum row count for precomputed queries.void
setObjectStoreAlias(java.lang.String objectStoreAlias)
void
setPrecomputePropertiesPath(java.lang.String precomputePropertiesPath)
-
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Field Detail
-
THREAD_COUNT
protected static final int THREAD_COUNT
- See Also:
- Constant Field Values
-
objectStoreAlias
protected java.lang.String objectStoreAlias
-
precomputePropertiesPath
protected java.lang.String precomputePropertiesPath
-
minRows
protected int minRows
-
-
Method Detail
-
setObjectStoreAlias
public void setObjectStoreAlias(java.lang.String objectStoreAlias)
- Parameters:
objectStoreAlias
- name of objectstore to use
-
setPrecomputePropertiesPath
public void setPrecomputePropertiesPath(java.lang.String precomputePropertiesPath)
- Parameters:
precomputePropertiesPath
- location of config file for precomputing
-
setMinRows
public void setMinRows(java.lang.Integer minRows)
Set the minimum row count for precomputed queries. Queries that are estimated to have less than this number of rows will not be precomputed.- Parameters:
minRows
- the minimum row count
-
execute
public void execute()
- Overrides:
execute
in classorg.apache.tools.ant.Task
-
precompute
public void precompute(boolean createAllOrders, ObjectStore os, int minRows)
Create precomputed tables for the given ObjectStore.- Parameters:
createAllOrders
- if true construct all permutations of order by for the QueryClass objects on the from listos
- The ObjectStore to add precomputed tables tominRows
- don't create any precomputed tables with less than this many rows- Throws:
org.apache.tools.ant.BuildException
- if something goes wrong
-
getPrecomputer
protected ParallelPrecomputer getPrecomputer(ObjectStoreInterMineImpl os)
Create a ParallelPrecomputer.- Parameters:
os
- an ObjectStoreInterMineImpl- Returns:
- a ParallelPrecomputer for the ObjectStore
-
constructQueries
protected static java.util.List<Query> constructQueries(boolean createAllOrders, ObjectStore os, java.lang.String path, java.lang.String precomputeKey) throws java.lang.ClassNotFoundException, ObjectStoreException
Create queries for given path. If path has a '+' next to any class then expand to include all subclasses.- Parameters:
createAllOrders
- if true construct all permutations of order by for the QueryClass objects on the from listos
- the ObjectStorepath
- the path to construct a query forprecomputeKey
- the key of the path in the config file, for logging- Returns:
- a list of queries
- Throws:
java.lang.ClassNotFoundException
- if problem processing pathjava.lang.IllegalArgumentException
- if problem processing pathObjectStoreException
- if there is a problem running a query to process the path
-
-