org.apache.flink.runtime.jobmaster.SlotOwner Java Examples
The following examples show how to use
org.apache.flink.runtime.jobmaster.SlotOwner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExecutionGraphSchedulingTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Nonnull static SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner, TaskManagerGateway taskManagerGateway, SlotRequestId slotRequestId) { TaskManagerLocation location = new TaskManagerLocation( ResourceID.generate(), InetAddress.getLoopbackAddress(), 12345); SimpleSlotContext slotContext = new SimpleSlotContext( new AllocationID(), location, 0, taskManagerGateway); return new SingleLogicalSlot( slotRequestId, slotContext, null, Locality.LOCAL, slotOwner); }
Example #2
Source File: ExecutionTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull private ProgrammedSlotProvider createProgrammedSlotProvider( int parallelism, Collection<JobVertexID> jobVertexIds, SlotOwner slotOwner) { final ProgrammedSlotProvider slotProvider = new ProgrammedSlotProvider(parallelism); for (JobVertexID jobVertexId : jobVertexIds) { for (int i = 0; i < parallelism; i++) { final LogicalSlot slot = createTestingLogicalSlot(slotOwner); slotProvider.addSlot(jobVertexId, 0, CompletableFuture.completedFuture(slot)); } } return slotProvider; }
Example #3
Source File: ExecutionGraphSchedulingTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull static SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner, TaskManagerGateway taskManagerGateway, SlotRequestId slotRequestId) { TaskManagerLocation location = new TaskManagerLocation( ResourceID.generate(), InetAddress.getLoopbackAddress(), 12345); SimpleSlotContext slotContext = new SimpleSlotContext( new AllocationID(), location, 0, taskManagerGateway); return new SingleLogicalSlot( slotRequestId, slotContext, null, Locality.LOCAL, slotOwner); }
Example #4
Source File: ExecutionVertexLocalityTest.java From flink with Apache License 2.0 | 6 votes |
private void initializeLocation(ExecutionVertex vertex, TaskManagerLocation location) throws Exception { // we need a bit of reflection magic to initialize the location without going through // scheduling paths. we choose to do that, rather than the alternatives: // - mocking the scheduler created fragile tests that break whenever the scheduler is adjusted // - exposing test methods in the ExecutionVertex leads to undesirable setters SlotContext slotContext = new SimpleSlotContext( new AllocationID(), location, 0, mock(TaskManagerGateway.class)); LogicalSlot slot = new SingleLogicalSlot( new SlotRequestId(), slotContext, null, Locality.LOCAL, mock(SlotOwner.class)); if (!vertex.getCurrentExecutionAttempt().tryAssignResource(slot)) { throw new FlinkException("Could not assign resource."); } }
Example #5
Source File: SingleLogicalSlot.java From flink with Apache License 2.0 | 6 votes |
public static SingleLogicalSlot allocateFromPhysicalSlot( final SlotRequestId slotRequestId, final PhysicalSlot physicalSlot, final Locality locality, final SlotOwner slotOwner, final boolean slotWillBeOccupiedIndefinitely) { final SingleLogicalSlot singleTaskSlot = new SingleLogicalSlot( slotRequestId, physicalSlot, null, locality, slotOwner, slotWillBeOccupiedIndefinitely); if (physicalSlot.tryAssignPayload(singleTaskSlot)) { return singleTaskSlot; } else { throw new IllegalStateException("BUG: Unexpected physical slot payload assignment failure!"); } }
Example #6
Source File: SingleLogicalSlot.java From flink with Apache License 2.0 | 6 votes |
public SingleLogicalSlot( SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner, boolean willBeOccupiedIndefinitely) { this.slotRequestId = Preconditions.checkNotNull(slotRequestId); this.slotContext = Preconditions.checkNotNull(slotContext); this.slotSharingGroupId = slotSharingGroupId; this.locality = Preconditions.checkNotNull(locality); this.slotOwner = Preconditions.checkNotNull(slotOwner); this.willBeOccupiedIndefinitely = willBeOccupiedIndefinitely; this.releaseFuture = new CompletableFuture<>(); this.state = State.ALIVE; this.payload = null; }
Example #7
Source File: ExecutionTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull private ProgrammedSlotProvider createProgrammedSlotProvider( int parallelism, Collection<JobVertexID> jobVertexIds, SlotOwner slotOwner) { final ProgrammedSlotProvider slotProvider = new ProgrammedSlotProvider(parallelism); for (JobVertexID jobVertexId : jobVertexIds) { for (int i = 0; i < parallelism; i++) { final LogicalSlot slot = createTestingLogicalSlot(slotOwner); slotProvider.addSlot(jobVertexId, 0, CompletableFuture.completedFuture(slot)); } } return slotProvider; }
Example #8
Source File: ExecutionGraphSchedulingTest.java From flink with Apache License 2.0 | 6 votes |
@Nonnull static SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner, TaskManagerGateway taskManagerGateway, SlotRequestId slotRequestId) { TaskManagerLocation location = new TaskManagerLocation( ResourceID.generate(), InetAddress.getLoopbackAddress(), 12345); SimpleSlotContext slotContext = new SimpleSlotContext( new AllocationID(), location, 0, taskManagerGateway); return new SingleLogicalSlot( slotRequestId, slotContext, null, Locality.LOCAL, slotOwner); }
Example #9
Source File: ExecutionVertexLocalityTest.java From flink with Apache License 2.0 | 6 votes |
private void initializeLocation(ExecutionVertex vertex, TaskManagerLocation location) throws Exception { // we need a bit of reflection magic to initialize the location without going through // scheduling paths. we choose to do that, rather than the alternatives: // - mocking the scheduler created fragile tests that break whenever the scheduler is adjusted // - exposing test methods in the ExecutionVertex leads to undesirable setters SlotContext slotContext = new SimpleSlotContext( new AllocationID(), location, 0, mock(TaskManagerGateway.class)); LogicalSlot slot = new SingleLogicalSlot( new SlotRequestId(), slotContext, null, Locality.LOCAL, mock(SlotOwner.class)); if (!vertex.getCurrentExecutionAttempt().tryAssignResource(slot)) { throw new FlinkException("Could not assign resource."); } }
Example #10
Source File: SingleLogicalSlot.java From flink with Apache License 2.0 | 6 votes |
public SingleLogicalSlot( SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner) { this.slotRequestId = Preconditions.checkNotNull(slotRequestId); this.slotContext = Preconditions.checkNotNull(slotContext); this.slotSharingGroupId = slotSharingGroupId; this.locality = Preconditions.checkNotNull(locality); this.slotOwner = Preconditions.checkNotNull(slotOwner); this.releaseFuture = new CompletableFuture<>(); this.state = State.ALIVE; this.payload = null; }
Example #11
Source File: ExecutionTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Nonnull private ProgrammedSlotProvider createProgrammedSlotProvider( int parallelism, Collection<JobVertexID> jobVertexIds, SlotOwner slotOwner) { final ProgrammedSlotProvider slotProvider = new ProgrammedSlotProvider(parallelism); for (JobVertexID jobVertexId : jobVertexIds) { for (int i = 0; i < parallelism; i++) { final SimpleSlot slot = new SimpleSlot( slotOwner, new LocalTaskManagerLocation(), 0, new SimpleAckingTaskManagerGateway(), null, null); slotProvider.addSlot(jobVertexId, 0, CompletableFuture.completedFuture(slot)); } } return slotProvider; }
Example #12
Source File: SingleLogicalSlot.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public SingleLogicalSlot( SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner) { this.slotRequestId = Preconditions.checkNotNull(slotRequestId); this.slotContext = Preconditions.checkNotNull(slotContext); this.slotSharingGroupId = slotSharingGroupId; this.locality = Preconditions.checkNotNull(locality); this.slotOwner = Preconditions.checkNotNull(slotOwner); this.releaseFuture = new CompletableFuture<>(); this.state = State.ALIVE; this.payload = null; }
Example #13
Source File: ExecutionVertexLocalityTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
private void initializeLocation(ExecutionVertex vertex, TaskManagerLocation location) throws Exception { // we need a bit of reflection magic to initialize the location without going through // scheduling paths. we choose to do that, rather than the alternatives: // - mocking the scheduler created fragile tests that break whenever the scheduler is adjusted // - exposing test methods in the ExecutionVertex leads to undesirable setters SlotContext slot = new SimpleSlotContext( new AllocationID(), location, 0, mock(TaskManagerGateway.class)); SimpleSlot simpleSlot = new SimpleSlot(slot, mock(SlotOwner.class), 0); if (!vertex.getCurrentExecutionAttempt().tryAssignResource(simpleSlot)) { throw new FlinkException("Could not assign resource."); } }
Example #14
Source File: SimpleSlot.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Creates a new simple slot that belongs to the given shared slot and * is identified by the given ID. * * @param owner The component from which this slot is allocated. * @param location The location info of the TaskManager where the slot was allocated from * @param slotNumber The number of the simple slot in its parent shared slot. * @param taskManagerGateway to communicate with the associated task manager. * @param parent The parent shared slot. * @param groupID The ID that identifies the group that the slot belongs to. */ public SimpleSlot( SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, @Nullable SharedSlot parent, @Nullable AbstractID groupID) { super( parent != null ? parent.getSlotContext() : new SimpleSlotContext( NO_ALLOCATION_ID, location, slotNumber, taskManagerGateway), owner, slotNumber, parent, groupID); }
Example #15
Source File: Slot.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Base constructor for slots. * * <p>This is the old way of constructing slots by the legacy code * * @param owner The component from which this slot is allocated. * @param location The location info of the TaskManager where the slot was allocated from * @param slotNumber The number of this slot. * @param taskManagerGateway The actor gateway to communicate with the TaskManager * @param parent The parent slot that contains this slot. May be null, if this slot is the root. * @param groupID The ID that identifies the task group for which this slot is allocated. May be null * if the slot does not belong to any task group. */ protected Slot( SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, @Nullable SharedSlot parent, @Nullable AbstractID groupID) { checkArgument(slotNumber >= 0); // create a simple slot context this.slotContext = new SimpleSlotContext( NO_ALLOCATION_ID, location, slotNumber, taskManagerGateway); this.owner = checkNotNull(owner); this.parent = parent; // may be null this.groupID = groupID; // may be null this.slotNumber = slotNumber; }
Example #16
Source File: SlotSharingManager.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
SlotSharingManager( SlotSharingGroupId slotSharingGroupId, AllocatedSlotActions allocatedSlotActions, SlotOwner slotOwner) { this.slotSharingGroupId = Preconditions.checkNotNull(slotSharingGroupId); this.allocatedSlotActions = Preconditions.checkNotNull(allocatedSlotActions); this.slotOwner = Preconditions.checkNotNull(slotOwner); allTaskSlots = new HashMap<>(16); unresolvedRootSlots = new HashMap<>(16); resolvedRootSlots = new HashMap<>(16); }
Example #17
Source File: SharedSlot.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private SharedSlot( SlotContext slotInformation, SlotOwner owner, int slotNumber, SlotSharingGroupAssignment assignmentGroup, @Nullable SharedSlot parent, @Nullable AbstractID groupId) { super(slotInformation, owner, slotNumber, parent, groupId); this.assignmentGroup = checkNotNull(assignmentGroup); this.subSlots = new HashSet<Slot>(); }
Example #18
Source File: SingleLogicalSlotTest.java From flink with Apache License 2.0 | 5 votes |
private SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner) { return new SingleLogicalSlot( new SlotRequestId(), createSlotContext(), null, Locality.LOCAL, slotOwner); }
Example #19
Source File: SlotSharingManager.java From flink with Apache License 2.0 | 5 votes |
SlotSharingManager( SlotSharingGroupId slotSharingGroupId, AllocatedSlotActions allocatedSlotActions, SlotOwner slotOwner) { this.slotSharingGroupId = Preconditions.checkNotNull(slotSharingGroupId); this.allocatedSlotActions = Preconditions.checkNotNull(allocatedSlotActions); this.slotOwner = Preconditions.checkNotNull(slotOwner); allTaskSlots = new HashMap<>(16); unresolvedRootSlots = new HashMap<>(16); resolvedRootSlots = new HashMap<>(16); }
Example #20
Source File: SingleLogicalSlot.java From flink with Apache License 2.0 | 5 votes |
@VisibleForTesting public SingleLogicalSlot( SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner) { this(slotRequestId, slotContext, slotSharingGroupId, locality, slotOwner, true); }
Example #21
Source File: Slot.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Base constructor for slots. * * @param slotContext The slot context of this slot. * @param owner The component from which this slot is allocated. * @param slotNumber The number of this slot. * @param parent The parent slot that contains this slot. May be null, if this slot is the root. * @param groupID The ID that identifies the task group for which this slot is allocated. May be null * if the slot does not belong to any task group. */ protected Slot( SlotContext slotContext, SlotOwner owner, int slotNumber, @Nullable SharedSlot parent, @Nullable AbstractID groupID) { this.slotContext = checkNotNull(slotContext); this.owner = checkNotNull(owner); this.parent = parent; // may be null this.groupID = groupID; // may be null this.slotNumber = slotNumber; }
Example #22
Source File: SingleLogicalSlotTest.java From flink with Apache License 2.0 | 5 votes |
private SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner) { return new SingleLogicalSlot( new SlotRequestId(), createSlotContext(), null, Locality.LOCAL, slotOwner); }
Example #23
Source File: SlotSharingManager.java From flink with Apache License 2.0 | 5 votes |
SlotSharingManager( SlotSharingGroupId slotSharingGroupId, AllocatedSlotActions allocatedSlotActions, SlotOwner slotOwner) { this.slotSharingGroupId = Preconditions.checkNotNull(slotSharingGroupId); this.allocatedSlotActions = Preconditions.checkNotNull(allocatedSlotActions); this.slotOwner = Preconditions.checkNotNull(slotOwner); allTaskSlots = new HashMap<>(16); unresolvedRootSlots = new HashMap<>(16); resolvedRootSlots = new HashMap<>(16); }
Example #24
Source File: ExecutionGraphTestUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static SimpleSlot createMockSimpleSlot(TaskManagerGateway gateway) { final TaskManagerLocation location = new TaskManagerLocation( ResourceID.generate(), InetAddress.getLoopbackAddress(), 6572); final SimpleSlotContext allocatedSlot = new SimpleSlotContext( new AllocationID(), location, 0, gateway); return new SimpleSlot( allocatedSlot, mock(SlotOwner.class), 0); }
Example #25
Source File: ExecutionGraphSchedulingTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private SimpleSlot createSlot(TaskManagerGateway taskManager, JobID jobId, SlotOwner slotOwner) { TaskManagerLocation location = new TaskManagerLocation( ResourceID.generate(), InetAddress.getLoopbackAddress(), 12345); SimpleSlotContext slot = new SimpleSlotContext( new AllocationID(), location, 0, taskManager); return new SimpleSlot(slot, slotOwner, 0); }
Example #26
Source File: ExecutionGraphDeploymentTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private SimpleSlot createSlot(TaskManagerLocation taskManagerLocation, int index) { return new SimpleSlot( mock(SlotOwner.class), taskManagerLocation, index, new SimpleAckingTaskManagerGateway()); }
Example #27
Source File: SingleLogicalSlotTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private SingleLogicalSlot createSingleLogicalSlot(SlotOwner slotOwner) { return new SingleLogicalSlot( new SlotRequestId(), new DummySlotContext(), null, Locality.LOCAL, slotOwner); }
Example #28
Source File: ExecutionTest.java From flink with Apache License 2.0 | 4 votes |
private TestingLogicalSlot createTestingLogicalSlot(SlotOwner slotOwner) { return new TestingLogicalSlotBuilder() .setSlotOwner(slotOwner) .createTestingLogicalSlot(); }
Example #29
Source File: SharedSlot.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Creates a new shared slot that has is a sub-slot of the given parent shared slot, and that belongs * to the given task group. * * @param owner The component from which this slot is allocated. * @param location The location info of the TaskManager where the slot was allocated from * @param slotNumber The number of the slot. * @param taskManagerGateway The gateway to communicate with the TaskManager * @param assignmentGroup The assignment group that this shared slot belongs to. * @param parent The parent slot of this slot. * @param groupId The assignment group of this slot. */ public SharedSlot( SlotOwner owner, TaskManagerLocation location, int slotNumber, TaskManagerGateway taskManagerGateway, SlotSharingGroupAssignment assignmentGroup, @Nullable SharedSlot parent, @Nullable AbstractID groupId) { super(owner, location, slotNumber, taskManagerGateway, parent, groupId); this.assignmentGroup = checkNotNull(assignmentGroup); this.subSlots = new HashSet<Slot>(); }
Example #30
Source File: ExecutionTest.java From flink with Apache License 2.0 | 4 votes |
private TestingLogicalSlot createTestingLogicalSlot(SlotOwner slotOwner) { return new TestingLogicalSlotBuilder() .setSlotOwner(slotOwner) .createTestingLogicalSlot(); }