Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParallelPrecomputer

        public ParallelPrecomputer​(ObjectStoreInterMineImpl os,
                                   int threadCount)
        Constructor.
        Parameters:
        os - an ObjectStoreInterMineImpl to perform the precomputes on
        threadCount - 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 logging
        query - the query to precompute
        indexes - the index QueryNodes
        allFields - whether to include all fields in the precomputed table
        category - the category of the precomputed table
        threadNo - the thread number, for logging
        Throws:
        ObjectStoreException - if the query cannot be precomputed.