org.apache.flink.mesos.util.MesosArtifactServer Java Examples

The following examples show how to use org.apache.flink.mesos.util.MesosArtifactServer. 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: MesosServicesUtils.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link MesosServices} instance depending on the high availability settings.
 *
 * @param configuration containing the high availability settings
 * @param hostname the hostname to advertise to remote clients
 * @return a mesos services instance
 * @throws Exception if the mesos services instance could not be created
 */
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception {

	ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration);

	MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname);

	HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);

	switch (highAvailabilityMode) {
		case NONE:
			return new StandaloneMesosServices(localActorSystem, artifactServer);

		case ZOOKEEPER:
			final String zkMesosRootPath = configuration.getString(
				HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH);

			ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory(
				configuration,
				zkMesosRootPath);

			return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory);

		default:
			throw new Exception("High availability mode " + highAvailabilityMode + " is not supported.");
	}
}
 
Example #2
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
MockMesosResourceManagerRuntimeServices() throws Exception {
	schedulerDriver = mock(SchedulerDriver.class);

	mesosConfig = mock(MesosConfiguration.class);
	when(mesosConfig.frameworkInfo()).thenReturn(Protos.FrameworkInfo.newBuilder());
	when(mesosConfig.withFrameworkInfo(any(Protos.FrameworkInfo.Builder.class))).thenReturn(mesosConfig);
	when(mesosConfig.createDriver(any(Scheduler.class), anyBoolean())).thenReturn(schedulerDriver);

	workerStore = mock(MesosWorkerStore.class);
	when(workerStore.getFrameworkID()).thenReturn(Option.<Protos.FrameworkID>empty());

	artifactServer = mock(MesosArtifactServer.class);
}
 
Example #3
Source File: LaunchableMesosWorker.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Configures an artifact server to serve the artifacts associated with a container specification.
 * @param server the server to configure.
 * @param container the container with artifacts to serve.
 * @throws IOException if the artifacts cannot be accessed.
 */
static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException {
	// serve the artifacts associated with the container environment
	for (ContainerSpecification.Artifact artifact : container.getArtifacts()) {
		server.addPath(artifact.source, artifact.dest);
	}
}
 
Example #4
Source File: MesosServicesUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link MesosServices} instance depending on the high availability settings.
 *
 * @param configuration containing the high availability settings
 * @param hostname the hostname to advertise to remote clients
 * @return a mesos services instance
 * @throws Exception if the mesos services instance could not be created
 */
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception {

	ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration);

	MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname);

	HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);

	switch (highAvailabilityMode) {
		case NONE:
			return new StandaloneMesosServices(localActorSystem, artifactServer);

		case ZOOKEEPER:
			final String zkMesosRootPath = configuration.getString(
				HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH);

			ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory(
				configuration,
				zkMesosRootPath);

			return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory);

		default:
			throw new Exception("High availability mode " + highAvailabilityMode + " is not supported.");
	}
}
 
Example #5
Source File: MesosServicesUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
private static MesosArtifactServer createArtifactServer(Configuration configuration, String hostname) throws Exception {
	final int artifactServerPort = configuration.getInteger(MesosOptions.ARTIFACT_SERVER_PORT, 0);

	// a random prefix is affixed to artifact URLs to ensure uniqueness in the Mesos fetcher cache
	final String artifactServerPrefix = UUID.randomUUID().toString();

	return new MesosArtifactServer(artifactServerPrefix, hostname, artifactServerPort, configuration);
}
 
Example #6
Source File: MesosServicesUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
private static MesosArtifactServer createArtifactServer(Configuration configuration, String hostname) throws Exception {
	final int artifactServerPort = configuration.getInteger(MesosOptions.ARTIFACT_SERVER_PORT, 0);

	// a random prefix is affixed to artifact URLs to ensure uniqueness in the Mesos fetcher cache
	final String artifactServerPrefix = UUID.randomUUID().toString();

	return new MesosArtifactServer(artifactServerPrefix, hostname, artifactServerPort, configuration);
}
 
Example #7
Source File: MesosServicesUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link MesosServices} instance depending on the high availability settings.
 *
 * @param configuration containing the high availability settings
 * @param hostname the hostname to advertise to remote clients
 * @return a mesos services instance
 * @throws Exception if the mesos services instance could not be created
 */
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception {

	ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration);

	MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname);

	HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);

	switch (highAvailabilityMode) {
		case NONE:
			return new StandaloneMesosServices(localActorSystem, artifactServer);

		case ZOOKEEPER:
			final String zkMesosRootPath = configuration.getString(
				HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH);

			ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory(
				configuration,
				zkMesosRootPath);

			return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory);

		default:
			throw new Exception("High availability mode " + highAvailabilityMode + " is not supported.");
	}
}
 
Example #8
Source File: LaunchableMesosWorker.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Configures an artifact server to serve the artifacts associated with a container specification.
 * @param server the server to configure.
 * @param container the container with artifacts to serve.
 * @throws IOException if the artifacts cannot be accessed.
 */
static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException {
	// serve the artifacts associated with the container environment
	for (ContainerSpecification.Artifact artifact : container.getArtifacts()) {
		server.addPath(artifact.source, artifact.dest);
	}
}
 
Example #9
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
MockMesosResourceManagerRuntimeServices() throws Exception {
	schedulerDriver = mock(SchedulerDriver.class);

	mesosConfig = mock(MesosConfiguration.class);
	when(mesosConfig.frameworkInfo()).thenReturn(Protos.FrameworkInfo.newBuilder());
	when(mesosConfig.withFrameworkInfo(any(Protos.FrameworkInfo.Builder.class))).thenReturn(mesosConfig);
	when(mesosConfig.createDriver(any(Scheduler.class), anyBoolean())).thenReturn(schedulerDriver);

	workerStore = mock(MesosWorkerStore.class);
	when(workerStore.getFrameworkID()).thenReturn(Option.<Protos.FrameworkID>empty());

	artifactServer = mock(MesosArtifactServer.class);
}
 
Example #10
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
MockMesosResourceManagerRuntimeServices() throws Exception {
	schedulerDriver = mock(SchedulerDriver.class);

	mesosConfig = mock(MesosConfiguration.class);
	when(mesosConfig.frameworkInfo()).thenReturn(Protos.FrameworkInfo.newBuilder());
	when(mesosConfig.withFrameworkInfo(any(Protos.FrameworkInfo.Builder.class))).thenReturn(mesosConfig);
	when(mesosConfig.createDriver(any(Scheduler.class), anyBoolean())).thenReturn(schedulerDriver);

	workerStore = mock(MesosWorkerStore.class);
	when(workerStore.getFrameworkID()).thenReturn(Option.<Protos.FrameworkID>empty());

	artifactServer = mock(MesosArtifactServer.class);
}
 
Example #11
Source File: LaunchableMesosWorker.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Configures an artifact server to serve the artifacts associated with a container specification.
 * @param server the server to configure.
 * @param container the container with artifacts to serve.
 * @throws IOException if the artifacts cannot be accessed.
 */
static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException {
	// serve the artifacts associated with the container environment
	for (ContainerSpecification.Artifact artifact : container.getArtifacts()) {
		server.addPath(artifact.source, artifact.dest);
	}
}
 
Example #12
Source File: MesosServicesUtils.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static MesosArtifactServer createArtifactServer(Configuration configuration, String hostname) throws Exception {
	final int artifactServerPort = configuration.getInteger(MesosOptions.ARTIFACT_SERVER_PORT, 0);

	// a random prefix is affixed to artifact URLs to ensure uniqueness in the Mesos fetcher cache
	final String artifactServerPrefix = UUID.randomUUID().toString();

	return new MesosArtifactServer(artifactServerPrefix, hostname, artifactServerPort, configuration);
}
 
Example #13
Source File: AbstractMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
protected AbstractMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	this.actorSystem = checkNotNull(actorSystem);
	this.artifactServer = checkNotNull(artifactServer);
}
 
Example #14
Source File: AbstractMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return artifactServer;
}
 
Example #15
Source File: ZooKeeperMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
public ZooKeeperMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer, ZooKeeperUtilityFactory zooKeeperUtilityFactory) {
	super(actorSystem, artifactServer);
	this.zooKeeperUtilityFactory = Preconditions.checkNotNull(zooKeeperUtilityFactory);
}
 
Example #16
Source File: StandaloneMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
protected StandaloneMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	super(actorSystem, artifactServer);
}
 
Example #17
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return rmServices.artifactServer;
}
 
Example #18
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return rmServices.artifactServer;
}
 
Example #19
Source File: StandaloneMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
protected StandaloneMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	super(actorSystem, artifactServer);
}
 
Example #20
Source File: ZooKeeperMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
public ZooKeeperMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer, ZooKeeperUtilityFactory zooKeeperUtilityFactory) {
	super(actorSystem, artifactServer);
	this.zooKeeperUtilityFactory = Preconditions.checkNotNull(zooKeeperUtilityFactory);
}
 
Example #21
Source File: AbstractMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return artifactServer;
}
 
Example #22
Source File: AbstractMesosServices.java    From flink with Apache License 2.0 4 votes vote down vote up
protected AbstractMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	this.actorSystem = checkNotNull(actorSystem);
	this.artifactServer = checkNotNull(artifactServer);
}
 
Example #23
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return rmServices.artifactServer;
}
 
Example #24
Source File: StandaloneMesosServices.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected StandaloneMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	super(actorSystem, artifactServer);
}
 
Example #25
Source File: ZooKeeperMesosServices.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public ZooKeeperMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer, ZooKeeperUtilityFactory zooKeeperUtilityFactory) {
	super(actorSystem, artifactServer);
	this.zooKeeperUtilityFactory = Preconditions.checkNotNull(zooKeeperUtilityFactory);
}
 
Example #26
Source File: AbstractMesosServices.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public MesosArtifactServer getArtifactServer() {
	return artifactServer;
}
 
Example #27
Source File: AbstractMesosServices.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected AbstractMesosServices(ActorSystem actorSystem, MesosArtifactServer artifactServer) {
	this.actorSystem = checkNotNull(actorSystem);
	this.artifactServer = checkNotNull(artifactServer);
}
 
Example #28
Source File: MesosServices.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the artifact server with which to serve essential resources to task managers.
 * @return a reference to an artifact server.
 */
MesosArtifactServer getArtifactServer();
 
Example #29
Source File: MesosServices.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the artifact server with which to serve essential resources to task managers.
 * @return a reference to an artifact server.
 */
MesosArtifactServer getArtifactServer();
 
Example #30
Source File: MesosServices.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the artifact server with which to serve essential resources to task managers.
 * @return a reference to an artifact server.
 */
MesosArtifactServer getArtifactServer();