Skip to content

[Improve] Flink-Yarn multi-version adaptation #4007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.streampark.flink.client.impl

import org.apache.streampark.flink.client.`trait`.YarnClientTrait
import org.apache.streampark.flink.client.bean._
import org.apache.streampark.flink.core.YarnClusterDescriptorWrapper
import org.apache.streampark.flink.util.FlinkUtils

import org.apache.flink.client.program.PackagedProgram
Expand Down Expand Up @@ -62,7 +63,8 @@ object YarnPerJobClient extends YarnClientTrait {
getYarnClusterDeployDescriptor(flinkConfig)
val flinkDistJar = FlinkUtils.getFlinkDistJar(flinkHome)
clusterDescriptor.setLocalJarPath(new HadoopPath(flinkDistJar))
clusterDescriptor.addShipFiles(List(new File(s"$flinkHome/lib")))
val clusterDescriptorWrapper = new YarnClusterDescriptorWrapper(clusterDescriptor)
clusterDescriptorWrapper.addShipFiles(List(new File(s"$flinkHome/lib")))

var packagedProgram: PackagedProgram = null
val clusterClient = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
<artifactId>hadoop-client-runtime</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-yarn${scala.binary.flink.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

import java.io.File
import java.util
import java.util.List

class YarnClusterDescriptorTrait(yarnClusterDescriptor: YarnClusterDescriptor) {
def addShipFiles(shipFiles: util.List[File]) =
yarnClusterDescriptor.addShipFiles(shipFiles)
}
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.
*/
package org.apache.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
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.
*/
package org.apache.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
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.
*/
package org.apache.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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.streampark.flink.core

import org.apache.flink.yarn.YarnClusterDescriptor

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {}
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.streampark.flink.core

import collection.JavaConverters._
import collection.mutable._
import org.apache.flink.yarn.YarnClusterDescriptor
import org.apache.hadoop.fs.Path

import java.io.File
import java.util

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {

override def addShipFiles(input: util.List[File]) = {
val shipFiles: Seq[File] = input.asScala
var paths: ArrayBuffer[Path] = ArrayBuffer[Path]()
for (item <- shipFiles) {
val path = new Path(item.toURI)
paths += path
}
yarnClusterDescriptor.addShipFiles(paths.asJava)
}
}
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.streampark.flink.core

import collection.JavaConverters._
import collection.mutable._
import org.apache.flink.yarn.YarnClusterDescriptor
import org.apache.hadoop.fs.Path

import java.io.File
import java.util

class YarnClusterDescriptorWrapper(yarnClusterDescriptor: YarnClusterDescriptor)
extends YarnClusterDescriptorTrait(yarnClusterDescriptor) {

override def addShipFiles(input: util.List[File]) = {
val shipFiles: Seq[File] = input.asScala
var paths: ArrayBuffer[Path] = ArrayBuffer[Path]()
for (item <- shipFiles) {
val path = new Path(item.toURI)
paths += path
}
yarnClusterDescriptor.addShipFiles(paths.asJava)
}
}
Loading