Skip to content

Commit da4bf4b

Browse files
yunfengzhou-hublindong28
authored andcommitted
[FLINK-27084] Fix classloader for per-round operators
This closes apache#125.
1 parent ee53ada commit da4bf4b

File tree

4 files changed

+6
-66
lines changed

4 files changed

+6
-66
lines changed

docs/content/docs/try-flink-ml/build-your-own-project.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ Learning Model and use it to provide prediction service.
3535
In order to use Flink ML in a Maven project, add the following dependencies to
3636
`pom.xml`.
3737

38-
{{< artifact flink-ml-core >}}
39-
40-
{{< artifact flink-ml-iteration >}}
41-
42-
{{< artifact flink-ml-lib >}}
38+
{{< artifact flink-ml-uber >}}
4339

4440
The example code provided in this document requires additional dependencies on
4541
the Flink Table API. In order to execute the example code successfully, please

docs/content/docs/try-flink-ml/quick-start.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ mvn clean package -DskipTests
6464
cd ./flink-ml-dist/target/flink-ml-*-bin/flink-ml*/
6565
```
6666

67-
### Add Flink ML binaries to Flink
68-
69-
You need to copy Flink ML's binary distribution files to Flink's folder for
70-
proper initialization. Please run the following command from Flink ML's binary
71-
distribution's folder.
72-
73-
```bash
74-
cp ./lib/*.jar $FLINK_HOME/lib/
75-
```
76-
7767
## Run Flink ML example job
7868

7969
Please start a Flink standalone cluster in your local environment with the
@@ -90,7 +80,7 @@ that the cluster is up and running.
9080
Then you may submit Flink ML examples to the cluster as follows.
9181

9282
```
93-
$FLINK_HOME/bin/flink run -c org.apache.flink.ml.examples.clustering.KMeansExample $FLINK_HOME/lib/flink-ml-examples*.jar
83+
$FLINK_HOME/bin/flink run -c org.apache.flink.ml.examples.clustering.KMeansExample -C file://`pwd`/lib/flink-ml-uber-2.2-SNAPSHOT.jar -C file://`pwd`/lib/statefun-flink-core-3.2.0.jar lib/flink-ml-examples-2.2-SNAPSHOT.jar
9484
```
9585

9686
The command above would submit and execute Flink ML's `KMeansExample` job. There

flink-ml-examples/pom.xml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,72 +33,25 @@ under the License.
3333
<dependencies>
3434
<dependency>
3535
<groupId>org.apache.flink</groupId>
36-
<artifactId>flink-ml-core</artifactId>
36+
<artifactId>flink-ml-uber</artifactId>
3737
<version>${project.version}</version>
3838
<scope>provided</scope>
3939
</dependency>
4040

4141
<dependency>
4242
<groupId>org.apache.flink</groupId>
43-
<artifactId>flink-ml-iteration</artifactId>
44-
<version>${project.version}</version>
45-
<scope>provided</scope>
46-
</dependency>
47-
48-
<dependency>
49-
<groupId>org.apache.flink</groupId>
50-
<artifactId>flink-ml-lib</artifactId>
51-
<version>${project.version}</version>
52-
<scope>provided</scope>
53-
</dependency>
54-
55-
<dependency>
56-
<groupId>org.apache.flink</groupId>
57-
<artifactId>flink-clients</artifactId>
58-
<version>${flink.version}</version>
59-
<scope>provided</scope>
60-
</dependency>
61-
62-
<dependency>
63-
<groupId>org.apache.flink</groupId>
64-
<artifactId>flink-streaming-java</artifactId>
65-
<version>${flink.version}</version>
66-
<scope>provided</scope>
67-
</dependency>
68-
69-
<dependency>
70-
<groupId>org.apache.flink</groupId>
71-
<artifactId>flink-table-api-java</artifactId>
72-
<version>${flink.version}</version>
73-
<scope>provided</scope>
74-
</dependency>
75-
76-
<dependency>
77-
<groupId>org.apache.flink</groupId>
78-
<artifactId>flink-table-api-java-bridge</artifactId>
43+
<artifactId>flink-table-planner-loader</artifactId>
7944
<version>${flink.version}</version>
8045
<scope>provided</scope>
8146
</dependency>
8247

8348
<dependency>
8449
<groupId>org.apache.flink</groupId>
8550
<artifactId>flink-table-runtime</artifactId>
86-
<scope>provided</scope>
87-
</dependency>
88-
89-
<dependency>
90-
<groupId>org.apache.flink</groupId>
91-
<artifactId>flink-table-common</artifactId>
9251
<version>${flink.version}</version>
9352
<scope>provided</scope>
9453
</dependency>
9554

96-
<dependency>
97-
<groupId>org.apache.flink</groupId>
98-
<artifactId>flink-table-planner-loader</artifactId>
99-
<scope>provided</scope>
100-
</dependency>
101-
10255
<dependency>
10356
<groupId>org.apache.flink</groupId>
10457
<artifactId>flink-test-utils</artifactId>

flink-ml-iteration/src/main/java/org/apache/flink/iteration/operator/perround/AbstractPerRoundWrapperOperator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private S getWrappedOperator(
158158
// We need to clone the operator factory to also support SimpleOperatorFactory.
159159
try {
160160
StreamOperatorFactory<T> clonedOperatorFactory =
161-
InstantiationUtil.clone(operatorFactory);
161+
InstantiationUtil.clone(
162+
operatorFactory, containingTask.getUserCodeClassLoader());
162163
wrappedOperator =
163164
(S)
164165
StreamOperatorFactoryUtil.<T, S>createOperator(

0 commit comments

Comments
 (0)