org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable Java Examples

The following examples show how to use org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable. 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: HashJoinIteratorBase.java    From flink with Apache License 2.0 6 votes vote down vote up
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer,
		TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer,
		TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBloomFilters) throws MemoryAllocationException {

	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new MutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager,
			useBloomFilters);
}
 
Example #2
Source File: UnilateralSortMerger.java    From flink with Apache License 2.0 6 votes vote down vote up
protected UnilateralSortMerger(MemoryManager memoryManager, List<MemorySegment> memory,
		IOManager ioManager,
		MutableObjectIterator<E> input, AbstractInvokable parentTask, 
		TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator,
		int numSortBuffers, int maxNumFileHandles,
		float startSpillingFraction, boolean noSpillingMemory, boolean handleLargeRecords,
		boolean objectReuseEnabled) throws IOException {
	this (
		memoryManager,
		memory,
		ioManager,
		input,
		parentTask,
		serializerFactory,
		comparator,
		numSortBuffers,
		maxNumFileHandles,
		startSpillingFraction,
		noSpillingMemory,
		handleLargeRecords,
		objectReuseEnabled,
		new DefaultInMemorySorterFactory<>(serializerFactory, comparator, THRESHOLD_FOR_IN_PLACE_SORTING));
}
 
Example #3
Source File: ExecutionGraphRescalingTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static JobVertex[] createVerticesForSimpleBipartiteJobGraph(int parallelism, int maxParallelism) {
	JobVertex v1 = new JobVertex("vertex1");
	JobVertex v2 = new JobVertex("vertex2");
	JobVertex v3 = new JobVertex("vertex3");
	JobVertex v4 = new JobVertex("vertex4");
	JobVertex v5 = new JobVertex("vertex5");

	JobVertex[] jobVertices = new JobVertex[]{v1, v2, v3, v4, v5};

	for (JobVertex jobVertex : jobVertices) {
		jobVertex.setInvokableClass(AbstractInvokable.class);
		jobVertex.setParallelism(parallelism);
		jobVertex.setMaxParallelism(maxParallelism);
	}

	v2.connectNewDataSetAsInput(v1, DistributionPattern.ALL_TO_ALL, ResultPartitionType.PIPELINED);
	v4.connectNewDataSetAsInput(v2, DistributionPattern.ALL_TO_ALL, ResultPartitionType.PIPELINED);
	v4.connectNewDataSetAsInput(v3, DistributionPattern.ALL_TO_ALL, ResultPartitionType.PIPELINED);
	v5.connectNewDataSetAsInput(v4, DistributionPattern.ALL_TO_ALL, ResultPartitionType.PIPELINED);
	v5.connectNewDataSetAsInput(v3, DistributionPattern.ALL_TO_ALL, ResultPartitionType.PIPELINED);

	return jobVertices;
}
 
Example #4
Source File: LargeRecordHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
public LargeRecordHandler(TypeSerializer<T> serializer, TypeComparator<T> comparator, 
		IOManager ioManager, MemoryManager memManager, List<MemorySegment> memory,
		AbstractInvokable memoryOwner, int maxFilehandles)
{
	this.serializer = checkNotNull(serializer);
	this.comparator = checkNotNull(comparator);
	this.ioManager = checkNotNull(ioManager);
	this.memManager = checkNotNull(memManager);
	this.memory = checkNotNull(memory);
	this.memoryOwner = checkNotNull(memoryOwner);
	this.maxFilehandles = maxFilehandles;

	this.executionConfig = memoryOwner.getExecutionConfig();

	checkArgument(maxFilehandles >= 2);
}
 
Example #5
Source File: StreamNode.java    From flink with Apache License 2.0 6 votes vote down vote up
public StreamNode(
		Integer id,
		@Nullable String slotSharingGroup,
		@Nullable String coLocationGroup,
		StreamOperatorFactory<?> operatorFactory,
		String operatorName,
		List<OutputSelector<?>> outputSelector,
		Class<? extends AbstractInvokable> jobVertexClass) {
	this.id = id;
	this.operatorName = operatorName;
	this.operatorFactory = operatorFactory;
	this.outputSelectors = outputSelector;
	this.jobVertexClass = jobVertexClass;
	this.slotSharingGroup = slotSharingGroup;
	this.coLocationGroup = coLocationGroup;
}
 
Example #6
Source File: TaskExecutorOperatorEventHandlingTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static TaskDeploymentDescriptor createTaskDeploymentDescriptor(
		JobID jobId,
		ExecutionAttemptID executionAttemptId,
		Class<? extends AbstractInvokable> invokableClass) throws IOException {

	return TaskExecutorSubmissionTest.createTaskDeploymentDescriptor(
			jobId,
			"test job",
			executionAttemptId,
			new SerializedValue<>(new ExecutionConfig()),
			"test task",
			64,
			3,
			17,
			0,
			new Configuration(),
			new Configuration(),
			invokableClass.getName(),
			Collections.emptyList(),
			Collections.emptyList(),
			Collections.emptyList(),
			Collections.emptyList(),
			0);
}
 
Example #7
Source File: StreamNode.java    From flink with Apache License 2.0 6 votes vote down vote up
public StreamNode(
	Integer id,
	@Nullable String slotSharingGroup,
	@Nullable String coLocationGroup,
	StreamOperatorFactory<?> operatorFactory,
	String operatorName,
	List<OutputSelector<?>> outputSelector,
	Class<? extends AbstractInvokable> jobVertexClass) {

	this.id = id;
	this.operatorName = operatorName;
	this.operatorFactory = operatorFactory;
	this.outputSelectors = outputSelector;
	this.jobVertexClass = jobVertexClass;
	this.slotSharingGroup = slotSharingGroup;
	this.coLocationGroup = coLocationGroup;
}
 
Example #8
Source File: StreamGraph.java    From flink with Apache License 2.0 6 votes vote down vote up
public <OUT> void addMultipleInputOperator(
		Integer vertexID,
		String slotSharingGroup,
		@Nullable String coLocationGroup,
		StreamOperatorFactory<OUT> operatorFactory,
		List<TypeInformation<?>> inTypeInfos,
		TypeInformation<OUT> outTypeInfo,
		String operatorName) {

	Class<? extends AbstractInvokable> vertexClass = MultipleInputStreamTask.class;

	addNode(vertexID, slotSharingGroup, coLocationGroup, vertexClass, operatorFactory, operatorName);

	setSerializers(vertexID, inTypeInfos, createSerializer(outTypeInfo));

	if (operatorFactory.isOutputTypeConfigurable()) {
		// sets the output type which must be know at StreamGraph creation time
		operatorFactory.setOutputType(outTypeInfo, executionConfig);
	}

	if (LOG.isDebugEnabled()) {
		LOG.debug("CO-TASK: {}", vertexID);
	}
}
 
Example #9
Source File: NonReusingBuildFirstReOpenableHashJoinIterator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer, TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer, TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager, IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new ReOpenableMutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager, useBitmapFilters);
}
 
Example #10
Source File: UnilateralSortMerger.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
protected UnilateralSortMerger(MemoryManager memoryManager, List<MemorySegment> memory,
		IOManager ioManager,
		MutableObjectIterator<E> input, AbstractInvokable parentTask, 
		TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator,
		int numSortBuffers, int maxNumFileHandles,
		float startSpillingFraction, boolean noSpillingMemory, boolean handleLargeRecords,
		boolean objectReuseEnabled) throws IOException {
	this (
		memoryManager,
		memory,
		ioManager,
		input,
		parentTask,
		serializerFactory,
		comparator,
		numSortBuffers,
		maxNumFileHandles,
		startSpillingFraction,
		noSpillingMemory,
		handleLargeRecords,
		objectReuseEnabled,
		new DefaultInMemorySorterFactory<>(serializerFactory, comparator, THRESHOLD_FOR_IN_PLACE_SORTING));
}
 
Example #11
Source File: HashJoinIteratorBase.java    From flink with Apache License 2.0 6 votes vote down vote up
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer,
		TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer,
		TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBloomFilters) throws MemoryAllocationException {

	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new MutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager,
			useBloomFilters);
}
 
Example #12
Source File: UnilateralSortMerger.java    From flink with Apache License 2.0 6 votes vote down vote up
protected UnilateralSortMerger(MemoryManager memoryManager, List<MemorySegment> memory,
		IOManager ioManager,
		MutableObjectIterator<E> input, AbstractInvokable parentTask, 
		TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator,
		int numSortBuffers, int maxNumFileHandles,
		float startSpillingFraction, boolean noSpillingMemory, boolean handleLargeRecords,
		boolean objectReuseEnabled) throws IOException {
	this (
		memoryManager,
		memory,
		ioManager,
		input,
		parentTask,
		serializerFactory,
		comparator,
		numSortBuffers,
		maxNumFileHandles,
		startSpillingFraction,
		noSpillingMemory,
		handleLargeRecords,
		objectReuseEnabled,
		new DefaultInMemorySorterFactory<>(serializerFactory, comparator, THRESHOLD_FOR_IN_PLACE_SORTING));
}
 
Example #13
Source File: ReusingBuildSecondReOpenableHashJoinIterator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <BT, PT> MutableHashTable<BT, PT> getHashJoin(
		TypeSerializer<BT> buildSideSerializer, TypeComparator<BT> buildSideComparator,
		TypeSerializer<PT> probeSideSerializer, TypeComparator<PT> probeSideComparator,
		TypePairComparator<PT, BT> pairComparator,
		MemoryManager memManager, IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	final int numPages = memManager.computeNumberOfPages(memoryFraction);
	final List<MemorySegment> memorySegments = memManager.allocatePages(ownerTask, numPages);
	
	return new ReOpenableMutableHashTable<BT, PT>(buildSideSerializer, probeSideSerializer,
			buildSideComparator, probeSideComparator, pairComparator,
			memorySegments, ioManager, useBitmapFilters);
}
 
Example #14
Source File: NonReusingBuildSecondReOpenableHashJoinIterator.java    From flink with Apache License 2.0 6 votes vote down vote up
public NonReusingBuildSecondReOpenableHashJoinIterator(
		MutableObjectIterator<V1> firstInput,
		MutableObjectIterator<V2> secondInput,
		TypeSerializer<V1> serializer1,
		TypeComparator<V1> comparator1,
		TypeSerializer<V2> serializer2,
		TypeComparator<V2> comparator2,
		TypePairComparator<V1, V2> pairComparator,
		MemoryManager memManager,
		IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean probeSideOuterJoin,
		boolean buildSideOuterJoin,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	super(firstInput, secondInput, serializer1, comparator1, serializer2,
			comparator2, pairComparator, memManager, ioManager, ownerTask,
			memoryFraction, probeSideOuterJoin, buildSideOuterJoin, useBitmapFilters);
	
	reopenHashTable = (ReOpenableMutableHashTable<V2, V1>) hashJoin;
}
 
Example #15
Source File: CheckpointBarrierAlignerTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testMissingCancellationBarriers() throws Exception {
	BufferOrEvent[] sequence = {
		createBarrier(1L, 0),
		createCancellationBarrier(3L, 1),
		createCancellationBarrier(2L, 0),
		createCancellationBarrier(3L, 0),
		createBuffer(0)
	};
	AbstractInvokable validator = new ValidatingCheckpointHandler();
	inputGate = createBarrierBuffer(2, sequence, validator);

	for (BufferOrEvent boe : sequence) {
		if (boe.isBuffer() || boe.getEvent().getClass() != CancelCheckpointMarker.class) {
			assertEquals(boe, inputGate.pollNext().get());
		}
	}

	Integer[] expectedUnblockedChannels = new Integer[] {0};
	assertArrayEquals(expectedUnblockedChannels, mockInputGate.getAndResetLastUnblockedChannels().toArray());
}
 
Example #16
Source File: MemoryManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void allocateTooMuch() {
	try {
		final AbstractInvokable mockInvoke = new DummyInvokable();

		List<MemorySegment> segs = this.memoryManager.allocatePages(mockInvoke, NUM_PAGES);

		testCannotAllocateAnymore(mockInvoke, 1);

		Assert.assertTrue("The previously allocated segments were not valid any more.",
																allMemorySegmentsValid(segs));

		this.memoryManager.releaseAll(mockInvoke);
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #17
Source File: MemoryManagerLazyAllocationTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void allocateMultipleOwners() {
	final int numOwners = 17;

	try {
		AbstractInvokable[] owners = new AbstractInvokable[numOwners];

		@SuppressWarnings("unchecked")
		List<MemorySegment>[] mems = (List<MemorySegment>[]) new List<?>[numOwners];

		for (int i = 0; i < numOwners; i++) {
			owners[i] = new DummyInvokable();
			mems[i] = new ArrayList<MemorySegment>(64);
		}

		// allocate all memory to the different owners
		for (int i = 0; i < NUM_PAGES; i++) {
			final int owner = this.random.nextInt(numOwners);
			mems[owner].addAll(this.memoryManager.allocatePages(owners[owner], 1));
		}

		// free one owner at a time
		for (int i = 0; i < numOwners; i++) {
			this.memoryManager.releaseAll(owners[i]);
			owners[i] = null;
			Assert.assertTrue("Released memory segments have not been destroyed.", allMemorySegmentsFreed(mems[i]));
			mems[i] = null;

			// check that the owner owners were not affected
			for (int k = i + 1; k < numOwners; k++) {
				Assert.assertTrue("Non-released memory segments are accidentaly destroyed.", allMemorySegmentsValid(mems[k]));
			}
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #18
Source File: UnilateralSortMerger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new sorting thread.
 * 
 * @param exceptionHandler The exception handler to call for all exceptions.
 * @param queues The queues used to pass buffers between the threads.
 * @param parentTask The task that started this thread. If non-null, it is used to register this thread.
 */
public SortingThread(ExceptionHandler<IOException> exceptionHandler, CircularQueues<E> queues,
		AbstractInvokable parentTask) {
	super(exceptionHandler, "SortMerger sorting thread", queues, parentTask);

	// members
	this.sorter = new QuickSort();
}
 
Example #19
Source File: PointwisePatternTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testNToN() throws Exception {
	final int N = 23;
	
	JobVertex v1 = new JobVertex("vertex1");
	JobVertex v2 = new JobVertex("vertex2");

	v1.setParallelism(N);
	v2.setParallelism(N);

	v1.setInvokableClass(AbstractInvokable.class);
	v2.setInvokableClass(AbstractInvokable.class);

	v2.connectNewDataSetAsInput(v1, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);

	List<JobVertex> ordered = new ArrayList<JobVertex>(Arrays.asList(v1, v2));

	ExecutionGraph eg = getDummyExecutionGraph();
	try {
		eg.attachJobGraph(ordered);
	}
	catch (JobException e) {
		e.printStackTrace();
		fail("Job failed with exception: " + e.getMessage());
	}
	
	ExecutionJobVertex target = eg.getAllVertices().get(v2.getID());
	
	for (ExecutionVertex ev : target.getTaskVertices()) {
		assertEquals(1, ev.getNumberOfInputs());
		
		ExecutionEdge[] inEdges = ev.getInputEdges(0);
		assertEquals(1, inEdges.length);
		
		assertEquals(ev.getParallelSubtaskIndex(), inEdges[0].getSource().getPartitionNumber());
	}
}
 
Example #20
Source File: FailoverRegionTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that if a task reports the result of its preceding task is failed,
 * its preceding task will be considered as failed, and start to failover
 * TODO: as the report part is not finished yet, this case is ignored temporarily
 * @throws Exception if fail to create dummy job information or fail to schedule for execution.
 */
@Ignore
@Test
public void testSucceedingNoticePreceding() throws Exception {
	final JobID jobId = new JobID();
	final String jobName = "Test Job Sample Name";

	final SimpleSlotProvider slotProvider = new SimpleSlotProvider(jobId, 14);

	JobVertex v1 = new JobVertex("vertex1");
	JobVertex v2 = new JobVertex("vertex2");

	v1.setParallelism(1);
	v2.setParallelism(1);

	v1.setInvokableClass(AbstractInvokable.class);
	v2.setInvokableClass(AbstractInvokable.class);

	v2.connectNewDataSetAsInput(v1, DistributionPattern.ALL_TO_ALL, ResultPartitionType.BLOCKING);

	ExecutionGraph eg = new ExecutionGraphTestUtils.TestingExecutionGraphBuilder(jobId, jobName, v1, v2)
		.setRestartStrategy(new InfiniteDelayRestartStrategy(10))
		.setFailoverStrategyFactory(new FailoverPipelinedRegionWithDirectExecutor())
		.setSlotProvider(slotProvider)
		.setScheduleMode(ScheduleMode.EAGER)
		.build();

	eg.scheduleForExecution();
	RestartPipelinedRegionStrategy strategy = (RestartPipelinedRegionStrategy)eg.getFailoverStrategy();

	ExecutionVertex ev11 = eg.getJobVertex(v2.getID()).getTaskVertices()[0];
	ExecutionVertex ev21 = eg.getJobVertex(v2.getID()).getTaskVertices()[0];
	ev21.getCurrentExecutionAttempt().fail(new Exception("Fail with v1"));

	assertEquals(JobStatus.CANCELLING, strategy.getFailoverRegion(ev21).getState());
	assertEquals(JobStatus.CANCELLING, strategy.getFailoverRegion(ev11).getState());
}
 
Example #21
Source File: UnilateralSortMerger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new reading thread.
 * 
 * @param exceptionHandler The exception handler to call for all exceptions.
 * @param reader The reader to pull the data from.
 * @param queues The queues used to pass buffers between the threads.
 * @param parentTask The task that started this thread. If non-null, it is used to register this thread.
 */
public ReadingThread(ExceptionHandler<IOException> exceptionHandler,
		MutableObjectIterator<E> reader, CircularQueues<E> queues,
		LargeRecordHandler<E> largeRecordsHandler, E readTarget,
		AbstractInvokable parentTask, long startSpillingBytes)
{
	super(exceptionHandler, "SortMerger Reading Thread", queues, parentTask);

	// members
	this.reader = reader;
	this.readTarget = readTarget;
	this.startSpillingBytes = startSpillingBytes;
	this.largeRecords = largeRecordsHandler;
}
 
Example #22
Source File: ChainedAllReduceDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
	this.reducer = red;
	FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());

	TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
	this.serializer = serializerFactory.getSerializer();

	if (LOG.isDebugEnabled()) {
		LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
	}
}
 
Example #23
Source File: LegacyJobVertexIdTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testIntroduceLegacyJobVertexIds() throws Exception {
	JobVertexID defaultId = new JobVertexID();
	JobVertexID legacyId1 = new JobVertexID();
	JobVertexID legacyId2 = new JobVertexID();

	JobVertex jobVertex = new JobVertex("test", defaultId, Arrays.asList(legacyId1, legacyId2), new ArrayList<OperatorID>(), new ArrayList<OperatorID>());
	jobVertex.setInvokableClass(AbstractInvokable.class);

	ExecutionGraph executionGraph = new ExecutionGraph(
		mock(ScheduledExecutorService.class),
		mock(Executor.class),
		new JobID(),
		"test",
		mock(Configuration.class),
		mock(SerializedValue.class),
		Time.seconds(1),
		mock(RestartStrategy.class),
		mock(SlotProvider.class));

	ExecutionJobVertex executionJobVertex =
			new ExecutionJobVertex(executionGraph, jobVertex, 1, Time.seconds(1));

	Map<JobVertexID, ExecutionJobVertex> idToVertex = new HashMap<>();
	idToVertex.put(executionJobVertex.getJobVertexId(), executionJobVertex);

	Assert.assertEquals(executionJobVertex, idToVertex.get(defaultId));
	Assert.assertNull(idToVertex.get(legacyId1));
	Assert.assertNull(idToVertex.get(legacyId2));

	idToVertex = ExecutionJobVertex.includeLegacyJobVertexIDs(idToVertex);

	Assert.assertEquals(3, idToVertex.size());
	Assert.assertEquals(executionJobVertex, idToVertex.get(defaultId));
	Assert.assertEquals(executionJobVertex, idToVertex.get(legacyId1));
	Assert.assertEquals(executionJobVertex, idToVertex.get(legacyId2));
}
 
Example #24
Source File: SpillingResettableMutableObjectIterator.java    From flink with Apache License 2.0 5 votes vote down vote up
public SpillingResettableMutableObjectIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, 
		MemoryManager memoryManager, IOManager ioManager,
		int numPages, AbstractInvokable parentTask)
throws MemoryAllocationException
{
	this(input, serializer, memoryManager, ioManager, memoryManager.allocatePages(parentTask, numPages), true);
}
 
Example #25
Source File: CombiningUnilateralSortMerger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public CombiningSpillingThread(ExceptionHandler<IOException> exceptionHandler, CircularQueues<E> queues,
		AbstractInvokable parentTask, MemoryManager memManager, IOManager ioManager, 
		TypeSerializer<E> serializer, TypeComparator<E> comparator, 
		List<MemorySegment> sortReadMemory, List<MemorySegment> writeMemory, int maxNumFileHandles,
		boolean objectReuseEnabled)
{
	super(exceptionHandler, queues, parentTask, memManager, ioManager, serializer, comparator, 
		sortReadMemory, writeMemory, maxNumFileHandles);
	
	this.comparator2 = comparator.duplicate();
	this.objectReuseEnabled = objectReuseEnabled;
}
 
Example #26
Source File: NonReusingBuildSecondHashJoinIterator.java    From flink with Apache License 2.0 5 votes vote down vote up
public NonReusingBuildSecondHashJoinIterator(
		MutableObjectIterator<V1> firstInput,
		MutableObjectIterator<V2> secondInput,
		TypeSerializer<V1> serializer1,
		TypeComparator<V1> comparator1,
		TypeSerializer<V2> serializer2,
		TypeComparator<V2> comparator2,
		TypePairComparator<V1, V2> pairComparator,
		MemoryManager memManager, IOManager ioManager,
		AbstractInvokable ownerTask,
		double memoryFraction,
		boolean probeSideOuterJoin,
		boolean buildSideOuterJoin,
		boolean useBitmapFilters) throws MemoryAllocationException {
	
	this.memManager = memManager;
	this.firstInput = firstInput;
	this.secondInput = secondInput;
	this.probeSideSerializer = serializer1;

	if(useBitmapFilters && probeSideOuterJoin) {
		throw new IllegalArgumentException("Bitmap filter may not be activated for joining with empty build side");
	}
	this.probeSideOuterJoin = probeSideOuterJoin;
	this.buildSideOuterJoin = buildSideOuterJoin;
	
	this.hashJoin = getHashJoin(serializer2, comparator2, serializer1,
			comparator1, pairComparator, memManager, ioManager, ownerTask, memoryFraction, useBitmapFilters);
}
 
Example #27
Source File: CheckpointBarrierAlignerTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
protected CheckpointedInputGate createBarrierBuffer(
	int numberOfChannels,
	BufferOrEvent[] sequence,
	@Nullable AbstractInvokable toNotify) throws IOException {
	MockInputGate gate = new MockInputGate(numberOfChannels, Arrays.asList(sequence));
	return createBarrierBuffer(gate, toNotify);
}
 
Example #28
Source File: UnilateralSortMerger.java    From flink with Apache License 2.0 5 votes vote down vote up
public UnilateralSortMerger(MemoryManager memoryManager, IOManager ioManager,
		MutableObjectIterator<E> input, AbstractInvokable parentTask,
		TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator,
		double memoryFraction, int numSortBuffers, int maxNumFileHandles,
		float startSpillingFraction, boolean handleLargeRecords, boolean objectReuseEnabled)
throws IOException, MemoryAllocationException
{
	this(memoryManager, ioManager, input, parentTask, serializerFactory, comparator,
		memoryFraction, numSortBuffers, maxNumFileHandles, startSpillingFraction, false, handleLargeRecords,
		objectReuseEnabled);
}
 
Example #29
Source File: DefaultSchedulerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobVertex createVertexWithAllInputConstraints(String name, int parallelism) {
	final JobVertex v = new JobVertex(name);
	v.setParallelism(parallelism);
	v.setInvokableClass(AbstractInvokable.class);
	v.setInputDependencyConstraint(InputDependencyConstraint.ALL);
	return v;
}
 
Example #30
Source File: UnilateralSortMerger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public UnilateralSortMerger(MemoryManager memoryManager, List<MemorySegment> memory,
		IOManager ioManager,
		MutableObjectIterator<E> input, AbstractInvokable parentTask, 
		TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator,
		int numSortBuffers, int maxNumFileHandles,
		float startSpillingFraction, boolean handleLargeRecords, boolean objectReuseEnabled)
throws IOException
{
	this(memoryManager, memory, ioManager, input, parentTask, serializerFactory, comparator,
		numSortBuffers, maxNumFileHandles, startSpillingFraction, false, handleLargeRecords,
		objectReuseEnabled);
}