T - type of the TaskSlotPayload stored in this slotpublic class TaskSlot<T extends TaskSlotPayload> extends Object implements org.apache.flink.util.AutoCloseableAsync
tasks belonging to the same slot. A TaskSlot can be in one of the following states:
A task slot can only be allocated if it is in state free. An allocated task slot can transit to state active.
An active slot allows to add tasks from the respective job and with the correct allocation id. An active slot can be marked as inactive which sets the state back to allocated.
An allocated or active slot can only be freed if it is empty. If it is not empty, then it's state can be set to releasing indicating that it can be freed once it becomes empty.
| 构造器和说明 |
|---|
TaskSlot(int index,
ResourceProfile resourceProfile,
int memoryPageSize,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
Executor asyncExecutor) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(T task)
Add the given task to the task slot.
|
void |
clear()
Removes all tasks from this task slot.
|
CompletableFuture<Void> |
closeAsync() |
SlotOffer |
generateSlotOffer()
Generate the slot offer from this TaskSlot.
|
AllocationID |
getAllocationId() |
int |
getIndex() |
org.apache.flink.api.common.JobID |
getJobId() |
MemoryManager |
getMemoryManager() |
ResourceProfile |
getResourceProfile() |
Iterator<T> |
getTasks()
Get all tasks running in this task slot.
|
boolean |
isActive(org.apache.flink.api.common.JobID activeJobId,
AllocationID activeAllocationId) |
boolean |
isAllocated(org.apache.flink.api.common.JobID jobIdToCheck,
AllocationID allocationIDToCheck) |
boolean |
isEmpty() |
boolean |
isReleasing() |
boolean |
markActive()
Mark this slot as active.
|
boolean |
markInactive()
Mark the slot as inactive/allocated.
|
T |
remove(ExecutionAttemptID executionAttemptId)
Remove the task identified by the given execution attempt id.
|
String |
toString() |
public TaskSlot(int index,
ResourceProfile resourceProfile,
int memoryPageSize,
org.apache.flink.api.common.JobID jobId,
AllocationID allocationId,
Executor asyncExecutor)
public int getIndex()
public ResourceProfile getResourceProfile()
public org.apache.flink.api.common.JobID getJobId()
public AllocationID getAllocationId()
public boolean isEmpty()
public boolean isActive(org.apache.flink.api.common.JobID activeJobId,
AllocationID activeAllocationId)
public boolean isAllocated(org.apache.flink.api.common.JobID jobIdToCheck,
AllocationID allocationIDToCheck)
public boolean isReleasing()
public Iterator<T> getTasks()
public MemoryManager getMemoryManager()
public boolean add(T task)
In case that the task slot state is not active an IllegalStateException is thrown.
In case that the task's job id and allocation id don't match with the job id and allocation
id for which the task slot has been allocated, an IllegalArgumentException is thrown.
task - to be added to the task slotIllegalStateException - if the task slot is not in state activepublic T remove(ExecutionAttemptID executionAttemptId)
executionAttemptId - identifying the task to be removedpublic void clear()
public boolean markActive()
The method returns true if the slot was set to active. Otherwise it returns false.
public boolean markInactive()
public SlotOffer generateSlotOffer()
public CompletableFuture<Void> closeAsync()
closeAsync 在接口中 org.apache.flink.util.AutoCloseableAsyncCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.