@Override
    public Map<ExecutionAttemptID, ExecutionSlotAssignment> allocateSlotsFor(
            List<ExecutionAttemptID> executionAttemptIds) {

        final Map<ExecutionVertexID, ExecutionAttemptID> vertexIdToExecutionId = new HashMap<>();
        executionAttemptIds.forEach(
                executionId ->
                        vertexIdToExecutionId.put(executionId.getExecutionVertexId(), executionId));

        checkState(
                vertexIdToExecutionId.size() == executionAttemptIds.size(),
                "SlotSharingExecutionSlotAllocator does not support one execution vertex to have multiple concurrent executions");

        final List<ExecutionVertexID> vertexIds =
                executionAttemptIds.stream()
                        .map(ExecutionAttemptID::getExecutionVertexId)
                        .collect(Collectors.toList());

        return allocateSlotsForVertices(vertexIds).stream()
                .collect(
                        Collectors.toMap(
                                vertexAssignment ->
                                        vertexIdToExecutionId.get(
                                                vertexAssignment.getExecutionVertexId()),
                                vertexAssignment ->
                                        new ExecutionSlotAssignment(
                                                vertexIdToExecutionId.get(
                                                        vertexAssignment.getExecutionVertexId()),
                                                vertexAssignment.getLogicalSlotFuture())));
    }
@Test
    void testAllocatePhysicalSlotForNewSharedSlot() {
        AllocationContext context =
                AllocationContext.newBuilder().addGroup(EV1, EV2).addGroup(EV3, EV4).build();

        Map<ExecutionAttemptID, ExecutionSlotAssignment> executionSlotAssignments =
                context.allocateSlotsFor(EV1, EV2, EV3, EV4);
        Collection<ExecutionVertexID> assignIds = getAssignIds(executionSlotAssignments.values());

        assertThat(assignIds).containsExactlyInAnyOrder(EV1, EV2, EV3, EV4);
        assertThat(context.getSlotProvider().getRequests()).hasSize(2);
    }