Java Code Examples for org.apache.flink.runtime.clusterframework.ContainerSpecification#Artifact

The following examples show how to use org.apache.flink.runtime.clusterframework.ContainerSpecification#Artifact . 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: Utils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Construct a Mesos URI.
 */
public static Protos.CommandInfo.URI uri(MesosArtifactResolver resolver, ContainerSpecification.Artifact artifact) {
	checkNotNull(resolver);
	checkNotNull(artifact);
	Option<URL> url = resolver.resolve(artifact.dest);
	if (url.isEmpty()) {
		throw new IllegalArgumentException("Unresolvable artifact: " + artifact.dest);
	}

	return Protos.CommandInfo.URI.newBuilder()
		.setValue(url.get().toExternalForm())
		.setOutputFile(artifact.dest.toString())
		.setExtract(artifact.extract)
		.setCache(artifact.cachable)
		.setExecutable(artifact.executable)
		.build();
}
 
Example 2
Source File: Utils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Construct a Mesos URI.
 */
public static Protos.CommandInfo.URI uri(MesosArtifactResolver resolver, ContainerSpecification.Artifact artifact) {
	checkNotNull(resolver);
	checkNotNull(artifact);
	Option<URL> url = resolver.resolve(artifact.dest);
	if (url.isEmpty()) {
		throw new IllegalArgumentException("Unresolvable artifact: " + artifact.dest);
	}

	return Protos.CommandInfo.URI.newBuilder()
		.setValue(url.get().toExternalForm())
		.setOutputFile(artifact.dest.toString())
		.setExtract(artifact.extract)
		.setCache(artifact.cachable)
		.setExecutable(artifact.executable)
		.build();
}
 
Example 3
Source File: Utils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Construct a Mesos URI.
 */
public static Protos.CommandInfo.URI uri(MesosArtifactResolver resolver, ContainerSpecification.Artifact artifact) {
	checkNotNull(resolver);
	checkNotNull(artifact);
	Option<URL> url = resolver.resolve(artifact.dest);
	if (url.isEmpty()) {
		throw new IllegalArgumentException("Unresolvable artifact: " + artifact.dest);
	}

	return Protos.CommandInfo.URI.newBuilder()
		.setValue(url.get().toExternalForm())
		.setOutputFile(artifact.dest.toString())
		.setExtract(artifact.extract)
		.setCache(artifact.cachable)
		.setExecutable(artifact.executable)
		.build();
}
 
Example 4
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 5
Source File: ContainerOverlayTestBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Check that an artifact exists for the given remote path.
    */
protected static ContainerSpecification.Artifact checkArtifact(ContainerSpecification spec, Path remotePath) {
	for(ContainerSpecification.Artifact artifact : spec.getArtifacts()) {
		if(remotePath.equals(artifact.dest)) {
			return artifact;
		}
	}
	throw new AssertionError("no such artifact (" + remotePath + ")");
}
 
Example 6
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 7
Source File: ContainerOverlayTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Check that an artifact exists for the given remote path.
    */
protected static ContainerSpecification.Artifact checkArtifact(ContainerSpecification spec, Path remotePath) {
	for(ContainerSpecification.Artifact artifact : spec.getArtifacts()) {
		if(remotePath.equals(artifact.dest)) {
			return artifact;
		}
	}
	throw new AssertionError("no such artifact (" + remotePath + ")");
}
 
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: ContainerOverlayTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Check that an artifact exists for the given remote path.
    */
protected static ContainerSpecification.Artifact checkArtifact(ContainerSpecification spec, Path remotePath) {
	for(ContainerSpecification.Artifact artifact : spec.getArtifacts()) {
		if(remotePath.equals(artifact.dest)) {
			return artifact;
		}
	}
	throw new AssertionError("no such artifact (" + remotePath + ")");
}