public class TaskSlotTableImpl<T extends TaskSlotPayload> extends Object implements TaskSlotTable<T>
TaskSlotTable.| 构造器和说明 |
|---|
TaskSlotTableImpl(int numberSlots,
ResourceProfile totalAvailableResourceProfile,
ResourceProfile defaultSlotResourceProfile,
int memoryPageSize,
TimerService<AllocationID> timerService,
Executor memoryVerificationExecutor) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addTask(T task)
Add the given task to the slot identified by the task's allocation id.
|
boolean |
allocateSlot(int requestedIndex,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
ResourceProfile resourceProfile,
org.apache.flink.api.common.time.Time slotTimeout)
Allocate the slot with the given index for the given job and allocation id.
|
boolean |
allocateSlot(int index,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
org.apache.flink.api.common.time.Time slotTimeout)
Allocate the slot with the given index for the given job and allocation id.
|
CompletableFuture<Void> |
closeAsync() |
SlotReport |
createSlotReport(ResourceID resourceId) |
int |
freeSlot(AllocationID allocationId,
Throwable cause)
Tries to free the slot.
|
Set<AllocationID> |
getActiveTaskSlotAllocationIds()
Returns the
AllocationID of any active task listed in this TaskSlotTable. |
Set<AllocationID> |
getActiveTaskSlotAllocationIdsPerJob(org.apache.flink.api.common.JobID jobId)
|
Iterator<TaskSlot<T>> |
getAllocatedSlots(org.apache.flink.api.common.JobID jobId)
Return an iterator of allocated slots for the given job id.
|
Set<AllocationID> |
getAllocationIdsPerJob(org.apache.flink.api.common.JobID jobId)
Returns the all
AllocationID for the given job. |
AllocationID |
getCurrentAllocation(int index)
Get the current allocation for the task slot with the given index.
|
org.apache.flink.api.common.JobID |
getOwningJob(AllocationID allocationId)
Returns the owning job of the
TaskSlot identified by the given AllocationID. |
T |
getTask(ExecutionAttemptID executionAttemptID)
Get the task for the given execution attempt id.
|
MemoryManager |
getTaskMemoryManager(AllocationID allocationID)
Get the memory manager of the slot allocated for the task.
|
Iterator<T> |
getTasks(org.apache.flink.api.common.JobID jobId)
Return an iterator over all tasks for a given job.
|
boolean |
hasAllocatedSlots(org.apache.flink.api.common.JobID jobId)
Check whether the job has allocated (not active) slots.
|
boolean |
isAllocated(int index,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId)
Check whether the slot for the given index is allocated for the given job and allocation id.
|
boolean |
isClosed() |
boolean |
isSlotFree(int index)
Check whether the task slot with the given index is free.
|
boolean |
isValidTimeout(AllocationID allocationId,
UUID ticket)
Check whether the timeout with ticket is valid for the given allocation id.
|
boolean |
markSlotActive(AllocationID allocationId)
Marks the slot under the given allocation id as active.
|
boolean |
markSlotInactive(AllocationID allocationId,
org.apache.flink.api.common.time.Time slotTimeout)
Marks the slot under the given allocation id as inactive.
|
void |
notifyTimeout(AllocationID key,
UUID ticket)
Notify the listener about the timeout for an event identified by key.
|
T |
removeTask(ExecutionAttemptID executionAttemptID)
Remove the task with the given execution attempt id from its task slot.
|
void |
start(SlotActions initialSlotActions,
org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor mainThreadExecutor)
Start the task slot table with the given slot actions.
|
boolean |
tryMarkSlotActive(org.apache.flink.api.common.JobID jobId,
AllocationID allocationId)
Try to mark the specified slot as active if it has been allocated by the given job.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfreeSlotpublic TaskSlotTableImpl(int numberSlots,
ResourceProfile totalAvailableResourceProfile,
ResourceProfile defaultSlotResourceProfile,
int memoryPageSize,
TimerService<AllocationID> timerService,
Executor memoryVerificationExecutor)
public void start(SlotActions initialSlotActions, org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor mainThreadExecutor)
TaskSlotTablestart 在接口中 TaskSlotTable<T extends TaskSlotPayload>initialSlotActions - to use for slot actionsmainThreadExecutor - ComponentMainThreadExecutor to schedule internal calls to
the main threadpublic CompletableFuture<Void> closeAsync()
closeAsync 在接口中 org.apache.flink.util.AutoCloseableAsync@VisibleForTesting public boolean isClosed()
public Set<AllocationID> getAllocationIdsPerJob(org.apache.flink.api.common.JobID jobId)
TaskSlotTableAllocationID for the given job.getAllocationIdsPerJob 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - for which to return the set of AllocationID.AllocationID for the given jobpublic Set<AllocationID> getActiveTaskSlotAllocationIds()
TaskSlotTableAllocationID of any active task listed in this TaskSlotTable.getActiveTaskSlotAllocationIds 在接口中 TaskSlotTable<T extends TaskSlotPayload>AllocationID of any active task.public Set<AllocationID> getActiveTaskSlotAllocationIdsPerJob(org.apache.flink.api.common.JobID jobId)
TaskSlotTablegetActiveTaskSlotAllocationIdsPerJob 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - The JobID of the job for which the AllocationIDs of the attached
active TaskSlots shall be returned.AllocationIDs that belong to active TaskSlots having the
passed JobID.public SlotReport createSlotReport(ResourceID resourceId)
createSlotReport 在接口中 TaskSlotTable<T extends TaskSlotPayload>@VisibleForTesting
public boolean allocateSlot(int index,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
org.apache.flink.api.common.time.Time slotTimeout)
TaskSlotTableallocateSlot 在接口中 TaskSlotTable<T extends TaskSlotPayload>index - of the task slot to allocate, use negative value for dynamic slot allocationjobId - to allocate the task slot forallocationId - identifying the allocationslotTimeout - until the slot times outpublic boolean allocateSlot(int requestedIndex,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
ResourceProfile resourceProfile,
org.apache.flink.api.common.time.Time slotTimeout)
TaskSlotTableallocateSlot 在接口中 TaskSlotTable<T extends TaskSlotPayload>requestedIndex - of the task slot to allocate, use negative value for dynamic slot allocationjobId - to allocate the task slot forallocationId - identifying the allocationresourceProfile - of the requested slot, used only for dynamic slot allocation and will
be ignored otherwiseslotTimeout - until the slot times outpublic boolean markSlotActive(AllocationID allocationId) throws SlotNotFoundException
TaskSlotTableSlotNotFoundException is thrown.markSlotActive 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationId - to identify the task slot to mark as activeSlotNotFoundException - if the slot could not be found for the given allocation idpublic boolean markSlotInactive(AllocationID allocationId, org.apache.flink.api.common.time.Time slotTimeout) throws SlotNotFoundException
TaskSlotTableSlotNotFoundException is thrown.markSlotInactive 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationId - to identify the task slot to mark as inactiveslotTimeout - until the slot times outSlotNotFoundException - if the slot could not be found for the given allocation idpublic int freeSlot(AllocationID allocationId, Throwable cause) throws SlotNotFoundException
TaskSlotTablefreeSlot 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationId - identifying the task slot to be freedcause - to fail the tasks with if slot is not emptySlotNotFoundException - if there is not task slot for the given allocation idpublic boolean isValidTimeout(AllocationID allocationId, UUID ticket)
TaskSlotTableisValidTimeout 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationId - to check againstticket - of the timeoutpublic boolean isAllocated(int index,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId)
TaskSlotTableisAllocated 在接口中 TaskSlotTable<T extends TaskSlotPayload>index - of the task slotjobId - for which the task slot should be allocatedallocationId - which should match the task slot's allocation idpublic boolean tryMarkSlotActive(org.apache.flink.api.common.JobID jobId,
AllocationID allocationId)
TaskSlotTabletryMarkSlotActive 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - of the allocated slotallocationId - identifying the allocationpublic boolean isSlotFree(int index)
TaskSlotTableisSlotFree 在接口中 TaskSlotTable<T extends TaskSlotPayload>index - of the task slotpublic boolean hasAllocatedSlots(org.apache.flink.api.common.JobID jobId)
TaskSlotTablehasAllocatedSlots 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - for which to check for allocated slotspublic Iterator<TaskSlot<T>> getAllocatedSlots(org.apache.flink.api.common.JobID jobId)
TaskSlotTablegetAllocatedSlots 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - for which to return the allocated slots@Nullable public org.apache.flink.api.common.JobID getOwningJob(AllocationID allocationId)
TaskSlotTableTaskSlot identified by the given AllocationID.getOwningJob 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationId - identifying the slot for which to retrieve the owning jobTaskSlot or null if there is no slot for the
given allocation id or if the slot has no owning job assignedpublic boolean addTask(T task) throws SlotNotFoundException, SlotNotActiveException
TaskSlotTableaddTask 在接口中 TaskSlotTable<T extends TaskSlotPayload>task - to add to the task slot with the respective allocation idSlotNotFoundException - if there was no slot for the given allocation idSlotNotActiveException - if there was no slot active for task's job and allocation idpublic T removeTask(ExecutionAttemptID executionAttemptID)
TaskSlotTableremoveTask 在接口中 TaskSlotTable<T extends TaskSlotPayload>executionAttemptID - identifying the task to removepublic T getTask(ExecutionAttemptID executionAttemptID)
TaskSlotTablegetTask 在接口中 TaskSlotTable<T extends TaskSlotPayload>executionAttemptID - identifying the requested taskpublic Iterator<T> getTasks(org.apache.flink.api.common.JobID jobId)
TaskSlotTablegetTasks 在接口中 TaskSlotTable<T extends TaskSlotPayload>jobId - identifying the job of the requested taskspublic AllocationID getCurrentAllocation(int index)
TaskSlotTablegetCurrentAllocation 在接口中 TaskSlotTable<T extends TaskSlotPayload>index - identifying the slot for which the allocation id shall be retrievedpublic MemoryManager getTaskMemoryManager(AllocationID allocationID) throws SlotNotFoundException
TaskSlotTablegetTaskMemoryManager 在接口中 TaskSlotTable<T extends TaskSlotPayload>allocationID - allocation id of the slot allocated for the taskSlotNotFoundExceptionpublic void notifyTimeout(AllocationID key, UUID ticket)
TimeoutListenernotifyTimeout 在接口中 TimeoutListener<AllocationID>key - identifying the timed out eventticket - used to check whether the timeout is still validCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.