use of org.apache.flink.runtime.blob.BlobCacheSizeTracker in project flink by apache.
the class DefaultExecutionGraphDeploymentWithSmallBlobCacheSizeLimitTest method testDeployMultipleTasksWithSmallBlobCacheSizeLimit.
/**
* Test the deployment works well even the size limit of {@link BlobCacheSizeTracker} in {@link
* PermanentBlobCache} is set to the minimum value.
*
* <p>In this extreme case, since the size limit is 1, every time a task is deployed, all the
* existing **tracked** BLOBs on the cache must be untracked and deleted before the new BLOB is
* stored onto the cache.
*
* <p>This extreme case covers the situation of the normal case, where the size limit is much
* larger than 1 and the deletion won't happen so frequently.
*/
@Test
public void testDeployMultipleTasksWithSmallBlobCacheSizeLimit() throws Exception {
final int numberOfVertices = 4;
final int parallelism = 10;
final ExecutionGraph eg = createAndSetupExecutionGraph(numberOfVertices, parallelism);
final SimpleAckingTaskManagerGateway taskManagerGateway = new SimpleAckingTaskManagerGateway();
final BlockingQueue<TaskDeploymentDescriptor> tdds = new ArrayBlockingQueue<>(numberOfVertices * parallelism);
taskManagerGateway.setSubmitConsumer(FunctionUtils.uncheckedConsumer(taskDeploymentDescriptor -> {
taskDeploymentDescriptor.loadBigData(blobCache);
tdds.offer(taskDeploymentDescriptor);
}));
for (ExecutionJobVertex ejv : eg.getVerticesTopologically()) {
for (ExecutionVertex ev : ejv.getTaskVertices()) {
assertEquals(ExecutionState.CREATED, ev.getExecutionState());
LogicalSlot slot = new TestingLogicalSlotBuilder().setTaskManagerGateway(taskManagerGateway).createTestingLogicalSlot();
final Execution execution = ev.getCurrentExecutionAttempt();
execution.transitionState(ExecutionState.SCHEDULED);
execution.registerProducedPartitions(slot.getTaskManagerLocation(), true).get();
ev.deployToSlot(slot);
assertEquals(ExecutionState.DEPLOYING, ev.getExecutionState());
TaskDeploymentDescriptor tdd = tdds.take();
assertNotNull(tdd);
List<InputGateDeploymentDescriptor> igdds = tdd.getInputGates();
assertEquals(ev.getAllConsumedPartitionGroups().size(), igdds.size());
if (igdds.size() > 0) {
checkShuffleDescriptors(igdds.get(0), ev.getConsumedPartitionGroup(0));
}
}
}
}
use of org.apache.flink.runtime.blob.BlobCacheSizeTracker in project flink by apache.
the class DefaultExecutionGraphDeploymentWithSmallBlobCacheSizeLimitTest method setupBlobServer.
@Before
@Override
public void setupBlobServer() throws IOException {
Configuration config = new Configuration();
// Always offload the serialized JobInformation, TaskInformation and cached
// ShuffleDescriptors
config.setInteger(BlobServerOptions.OFFLOAD_MINSIZE, 0);
blobServer = new BlobServer(config, TEMPORARY_FOLDER.newFolder(), new VoidBlobStore());
blobServer.start();
blobWriter = blobServer;
InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
// Set the size limit of the blob cache to 1
BlobCacheSizeTracker blobCacheSizeTracker = new BlobCacheSizeTracker(1L);
blobCache = new PermanentBlobCache(config, TEMPORARY_FOLDER.newFolder(), new VoidBlobStore(), serverAddress, blobCacheSizeTracker);
}
Aggregations