Class ThrottledResourceManager.QueuedQueryResourceManager
java.lang.Object
org.apache.drill.exec.work.foreman.rm.ThrottledResourceManager.QueuedResourceAllocator
org.apache.drill.exec.work.foreman.rm.ThrottledResourceManager.QueuedQueryResourceManager
- All Implemented Interfaces:
QueryResourceAllocator
,QueryResourceManager
- Enclosing class:
- ThrottledResourceManager
public static class ThrottledResourceManager.QueuedQueryResourceManager
extends ThrottledResourceManager.QueuedResourceAllocator
implements QueryResourceManager
Per-query resource manager. Handles resources and optional queue lease for
a single query. As such, this is a non-shared resource: it is associated
with a Foreman: a single thread at plan time, and a single event (in some
thread) at query completion time. Because of these semantics, no
synchronization is needed within this class.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.work.foreman.rm.ThrottledResourceManager.QueuedResourceAllocator
ThrottledResourceManager.QueuedResourceAllocator.BufferedOpFinder
-
Field Summary
Fields inherited from class org.apache.drill.exec.work.foreman.rm.ThrottledResourceManager.QueuedResourceAllocator
plan, queryContext, queryCost, rm, work
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
admit()
Admit the query into the cluster.void
exit()
Mark the query as completing, giving up its slot in the cluster.getParallelizer
(boolean planHasMemory) Create a parallelizer to parallelize each major fragment of the query into many minor fragments.boolean
hasQueue()
Hint that this resource manager queues.protected long
Returns the name of the queue (if any) on which the query was placed.void
setCost
(double cost) For some cases the foreman does not have a full plan, just a cost.Methods inherited from class org.apache.drill.exec.work.foreman.rm.ThrottledResourceManager.QueuedResourceAllocator
getQueryContext, visitAbstractPlan, visitPhysicalPlan
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.drill.exec.work.foreman.rm.QueryResourceAllocator
visitAbstractPlan, visitPhysicalPlan
-
Constructor Details
-
QueuedQueryResourceManager
-
-
Method Details
-
setCost
public void setCost(double cost) Description copied from interface:QueryResourceManager
For some cases the foreman does not have a full plan, just a cost. In this case, this object will not plan memory, but still needs the cost to place the job into the correct queue.- Specified by:
setCost
in interfaceQueryResourceManager
-
getParallelizer
Description copied from interface:QueryResourceManager
Create a parallelizer to parallelize each major fragment of the query into many minor fragments. The parallelizer encapsulates the logic of how much memory and parallelism is required for the query.- Specified by:
getParallelizer
in interfaceQueryResourceManager
- Parameters:
planHasMemory
- memory planning needs to be done during parallelization- Returns:
-
admit
Description copied from interface:QueryResourceManager
Admit the query into the cluster. Blocks until the query can run. (Later revisions may use a more thread-friendly approach.)- Specified by:
admit
in interfaceQueryResourceManager
- Throws:
QueryQueue.QueueTimeoutException
- if the query timed out waiting to be admitted.QueryQueue.QueryQueueException
- if something goes wrong with the queue mechanism
-
queryMemoryPerNode
protected long queryMemoryPerNode()- Overrides:
queryMemoryPerNode
in classThrottledResourceManager.QueuedResourceAllocator
-
exit
public void exit()Description copied from interface:QueryResourceManager
Mark the query as completing, giving up its slot in the cluster. Releases any lease that may be held for a system with queues.- Specified by:
exit
in interfaceQueryResourceManager
-
hasQueue
public boolean hasQueue()Description copied from interface:QueryResourceManager
Hint that this resource manager queues. Allows the Foreman to short-circuit expensive logic if no queuing will actually be done. This is a static attribute per Drillbit run.- Specified by:
hasQueue
in interfaceQueryResourceManager
-
queueName
Description copied from interface:QueryResourceManager
Returns the name of the queue (if any) on which the query was placed. Valid only after the query is admitted.- Specified by:
queueName
in interfaceQueryResourceManager
- Returns:
- queue name, or null if queuing is not enabled.
-