Class ParallelPrecomputer
- java.lang.Object
-
- org.intermine.objectstore.intermine.ParallelPrecomputer
-
public class ParallelPrecomputer extends java.lang.Object
An object that can perform a set of precomputes in parallel.- Author:
- Matthew Wakeling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParallelPrecomputer.Job
Class representing a precomputing job to be performed.
-
Constructor Summary
Constructors Constructor Description ParallelPrecomputer(ObjectStoreInterMineImpl os, int threadCount)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectStoreInterMineImpl
getObjectStore()
Returns the ObjectStore that this ParallelPrecomputer uses.void
precompute(java.util.Collection<ParallelPrecomputer.Job> jobs)
Perform a load of precompute operations in parallel.protected void
precomputeQuery(java.lang.String key, Query query, java.util.Collection<? extends QueryNode> indexes, boolean allFields, java.lang.String category, int threadNo)
Call ObjectStoreInterMineImpl.precompute() with the given Query.void
setMinRows(int minRows)
Set the minimum row count for precomputed queries.
-
-
-
Constructor Detail
-
ParallelPrecomputer
public ParallelPrecomputer(ObjectStoreInterMineImpl os, int threadCount)
Constructor.- Parameters:
os
- an ObjectStoreInterMineImpl to perform the precomputes onthreadCount
- the number of operations to perform in parallel
-
-
Method Detail
-
setMinRows
public void setMinRows(int 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
-
getObjectStore
public ObjectStoreInterMineImpl getObjectStore()
Returns the ObjectStore that this ParallelPrecomputer uses.- Returns:
- an ObjectStoreInterMineImpl
-
precompute
public void precompute(java.util.Collection<ParallelPrecomputer.Job> jobs) throws ObjectStoreException
Perform a load of precompute operations in parallel. Jobs with fewer expected rows than the minRows parameter are not processed. Jobs are processed in decreasing order of expected time taken, which tends to reduce the total time taken.- Parameters:
jobs
- a collection of jobs to precompute- Throws:
ObjectStoreException
- if an error occurs
-
precomputeQuery
protected void precomputeQuery(java.lang.String key, Query query, java.util.Collection<? extends QueryNode> indexes, boolean allFields, java.lang.String category, int threadNo) throws ObjectStoreException
Call ObjectStoreInterMineImpl.precompute() with the given Query.- Parameters:
key
- the String describing the job, for loggingquery
- the query to precomputeindexes
- the index QueryNodesallFields
- whether to include all fields in the precomputed tablecategory
- the category of the precomputed tablethreadNo
- the thread number, for logging- Throws:
ObjectStoreException
- if the query cannot be precomputed.
-
-