Class 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  
      • Fields inherited from class org.apache.tools.ant.Task

        description, location, target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        project
    • 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
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        getProject, setProject
      • Methods inherited from class java.lang.Object

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

      • objectStoreAlias

        protected java.lang.String objectStoreAlias
      • precomputePropertiesPath

        protected java.lang.String precomputePropertiesPath
      • minRows

        protected int minRows
    • Constructor Detail

      • PrecomputeTask

        public PrecomputeTask()
    • 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 class org.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 list
        os - The ObjectStore to add precomputed tables to
        minRows - 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 list
        os - the ObjectStore
        path - the path to construct a query for
        precomputeKey - the key of the path in the config file, for logging
        Returns:
        a list of queries
        Throws:
        java.lang.ClassNotFoundException - if problem processing path
        java.lang.IllegalArgumentException - if problem processing path
        ObjectStoreException - if there is a problem running a query to process the path