forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minimal HarnessManager Interface (#2)
Write minimal interface for Flink HarnessManager and related classes. This defines a minimal interface for a Flink HarnessManager, as well as the related interfaces of EnvironmentSession and ArtifactSource. Add beam-runners-java-fn-execution to the flink-runner's maven and gradle dependencies for planned work on integrating with the beam portability framework. This will be necessary to interact with protobufs related to the artifact API while implementing ArtifactService and related classes.
- Loading branch information
Showing
8 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
runners/flink/src/main/java/org/apache/beam/runners/flink/execution/EnvironmentSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.beam.runners.flink.execution; | ||
|
||
import org.apache.beam.model.pipeline.v1.RunnerApi.Environment; | ||
import org.apache.beam.runners.fnexecution.artifact.ArtifactSource; | ||
import org.apache.beam.runners.fnexecution.control.SdkHarnessClient; | ||
|
||
/** | ||
* A handle to an {@link Environment} managed by a {@link SdkHarnessManager}. | ||
* Closing the session indicates to the session's {@link SdkHarnessManager} | ||
* that it can no longer use session resources such as its | ||
* {@link ArtifactSource}. | ||
*/ | ||
public interface EnvironmentSession extends AutoCloseable { | ||
|
||
/** | ||
* Get the environment that the session uses. | ||
*/ | ||
Environment getEnvironment(); | ||
|
||
/** | ||
* Get the ArtifactSource that the session uses. | ||
*/ | ||
ArtifactSource getArtifactSource(); | ||
|
||
/** | ||
* Get an {@link SdkHarnessClient} that can communicate with an instance of the environment. | ||
*/ | ||
SdkHarnessClient getClient(); | ||
} |
37 changes: 37 additions & 0 deletions
37
runners/flink/src/main/java/org/apache/beam/runners/flink/execution/SdkHarnessManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.beam.runners.flink.execution; | ||
|
||
import org.apache.beam.model.pipeline.v1.RunnerApi.Environment; | ||
import org.apache.beam.runners.fnexecution.artifact.ArtifactSource; | ||
|
||
/** | ||
* A long-lived class to manage SDK harness container instances on behalf of | ||
* shorter-lived Flink operators. | ||
*/ | ||
public interface SdkHarnessManager { | ||
/** | ||
* Get a new {@link EnvironmentSession} to an {@link Environment} container | ||
* instance, creating a new instance if necessary. | ||
* | ||
* @param environment The environment specification for the desired session. | ||
* @param artifactSource An artifact source that can be used during creation. | ||
*/ | ||
EnvironmentSession getSession(String jobId, Environment environment, ArtifactSource artifactSource); | ||
} |
22 changes: 22 additions & 0 deletions
22
runners/flink/src/main/java/org/apache/beam/runners/flink/execution/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Internal metrics implementation of the Beam runner for Apache Flink. | ||
*/ | ||
package org.apache.beam.runners.flink.execution; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...-execution/src/main/java/org/apache/beam/runners/fnexecution/artifact/ArtifactSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.beam.runners.fnexecution.artifact; | ||
|
||
import org.apache.beam.model.jobmanagement.v1.ArtifactApi; | ||
|
||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Makes artifacts available to an ArtifactRetrievalService by | ||
* encapsulating runner-specific resources. | ||
*/ | ||
public interface ArtifactSource { | ||
|
||
/** | ||
* Get the artifact manifest available from this source. | ||
*/ | ||
ArtifactApi.Manifest getManifest(); | ||
|
||
/** | ||
* Get an artifact by its name. | ||
*/ | ||
Stream<ArtifactApi.ArtifactChunk> getArtifact(String name); | ||
} |