Java Code Examples for org.apache.flink.runtime.blob.BlobServer#getPort()

The following examples show how to use org.apache.flink.runtime.blob.BlobServer#getPort() . 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: ClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected void initializeServices(Configuration configuration) throws Exception {

		LOG.info("Initializing cluster services.");

		synchronized (lock) {
			final String bindAddress = configuration.getString(JobManagerOptions.ADDRESS);
			final String portRange = getRPCPortRange(configuration);

			commonRpcService = createRpcService(configuration, bindAddress, portRange);

			// update the configuration used to create the high availability services
			configuration.setString(JobManagerOptions.ADDRESS, commonRpcService.getAddress());
			configuration.setInteger(JobManagerOptions.PORT, commonRpcService.getPort());

			ioExecutor = Executors.newFixedThreadPool(
				Hardware.getNumberCPUCores(),
				new ExecutorThreadFactory("cluster-io"));
			haServices = createHaServices(configuration, ioExecutor);
			blobServer = new BlobServer(configuration, haServices.createBlobStore());
			blobServer.start();
			heartbeatServices = createHeartbeatServices(configuration);
			metricRegistry = createMetricRegistry(configuration);

			// TODO: This is a temporary hack until we have ported the MetricQueryService to the new RpcEndpoint
			// Start actor system for metric query service on any available port
			metricQueryServiceActorSystem = MetricUtils.startMetricsActorSystem(configuration, bindAddress, LOG);
			metricRegistry.startQueryService(metricQueryServiceActorSystem, null);

			archivedExecutionGraphStore = createSerializableExecutionGraphStore(configuration, commonRpcService.getScheduledExecutor());

			transientBlobCache = new TransientBlobCache(
				configuration,
				new InetSocketAddress(
					commonRpcService.getAddress(),
					blobServer.getPort()));
		}
	}
 
Example 2
Source File: ExecutionGraphDeploymentWithBlobCacheTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Before
@Override
public void setupBlobServer() throws IOException {
	Configuration config = new Configuration();
	// always offload the serialized job and task information
	config.setInteger(BlobServerOptions.OFFLOAD_MINSIZE, 0);
	blobServer = new BlobServer(config, new VoidBlobStore());
	blobServer.start();
	blobWriter = blobServer;

	InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
	blobCache = new PermanentBlobCache(config, new VoidBlobStore(), serverAddress);
}
 
Example 3
Source File: ExecutionGraphDeploymentWithBlobCacheTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
@Override
public void setupBlobServer() throws IOException {
	Configuration config = new Configuration();
	// always offload the serialized job and task information
	config.setInteger(BlobServerOptions.OFFLOAD_MINSIZE, 0);
	blobServer = new BlobServer(config, new VoidBlobStore());
	blobServer.start();
	blobWriter = blobServer;

	InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
	blobCache = new PermanentBlobCache(config, new VoidBlobStore(), serverAddress);
}
 
Example 4
Source File: ExecutionGraphDeploymentWithBlobCacheTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
@Override
public void setupBlobServer() throws IOException {
	Configuration config = new Configuration();
	// always offload the serialized job and task information
	config.setInteger(BlobServerOptions.OFFLOAD_MINSIZE, 0);
	blobServer = new BlobServer(config, new VoidBlobStore());
	blobServer.start();
	blobWriter = blobServer;

	InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
	blobCache = new PermanentBlobCache(config, new VoidBlobStore(), serverAddress);
}
 
Example 5
Source File: TaskTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testExecutionFailsInBlobsMissing() throws Exception {
	final PermanentBlobKey missingKey = new PermanentBlobKey();

	final Configuration config = new Configuration();
	config.setString(BlobServerOptions.STORAGE_DIRECTORY,
		TEMPORARY_FOLDER.newFolder().getAbsolutePath());
	config.setLong(BlobServerOptions.CLEANUP_INTERVAL, 1L);

	final BlobServer blobServer = new BlobServer(config, new VoidBlobStore());
	blobServer.start();
	InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
	final PermanentBlobCache permanentBlobCache = new PermanentBlobCache(config, new VoidBlobStore(), serverAddress);

	final BlobLibraryCacheManager libraryCacheManager =
		new BlobLibraryCacheManager(
			permanentBlobCache,
			FlinkUserCodeClassLoaders.ResolveOrder.CHILD_FIRST,
			new String[0]);

	final Task task = new TaskBuilder()
		.setRequiredJarFileBlobKeys(Collections.singletonList(missingKey))
		.setLibraryCacheManager(libraryCacheManager)
		.build();

	// task should be new and perfect
	assertEquals(ExecutionState.CREATED, task.getExecutionState());
	assertFalse(task.isCanceledOrFailed());
	assertNull(task.getFailureCause());

	// should fail
	task.run();

	// verify final state
	assertEquals(ExecutionState.FAILED, task.getExecutionState());
	assertTrue(task.isCanceledOrFailed());
	assertNotNull(task.getFailureCause());
	assertNotNull(task.getFailureCause().getMessage());
	assertTrue(task.getFailureCause().getMessage().contains("Failed to fetch BLOB"));

	assertNull(task.getInvokable());
}
 
Example 6
Source File: TaskTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testExecutionFailsInBlobsMissing() throws Exception {
	final PermanentBlobKey missingKey = new PermanentBlobKey();

	final Configuration config = new Configuration();
	config.setString(BlobServerOptions.STORAGE_DIRECTORY,
		TEMPORARY_FOLDER.newFolder().getAbsolutePath());
	config.setLong(BlobServerOptions.CLEANUP_INTERVAL, 1L);

	final BlobServer blobServer = new BlobServer(config, new VoidBlobStore());
	blobServer.start();
	InetSocketAddress serverAddress = new InetSocketAddress("localhost", blobServer.getPort());
	final PermanentBlobCache permanentBlobCache = new PermanentBlobCache(config, new VoidBlobStore(), serverAddress);

	final BlobLibraryCacheManager libraryCacheManager =
		new BlobLibraryCacheManager(
			permanentBlobCache,
			FlinkUserCodeClassLoaders.ResolveOrder.CHILD_FIRST,
			new String[0]);

	final Task task = createTaskBuilder()
		.setRequiredJarFileBlobKeys(Collections.singletonList(missingKey))
		.setLibraryCacheManager(libraryCacheManager)
		.build();

	// task should be new and perfect
	assertEquals(ExecutionState.CREATED, task.getExecutionState());
	assertFalse(task.isCanceledOrFailed());
	assertNull(task.getFailureCause());

	// should fail
	task.run();

	// verify final state
	assertEquals(ExecutionState.FAILED, task.getExecutionState());
	assertTrue(task.isCanceledOrFailed());
	assertNotNull(task.getFailureCause());
	assertNotNull(task.getFailureCause().getMessage());
	assertTrue(task.getFailureCause().getMessage().contains("Failed to fetch BLOB"));

	assertNull(task.getInvokable());
}