You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/15 12:25:34 UTC

[GitHub] [flink] wangyang0918 commented on a change in pull request #12170: [FLINK-17729] Make mandatory to have lib/, plugin/ and dist in yarn.provided.lib.dirs

wangyang0918 commented on a change in pull request #12170:
URL: https://github.com/apache/flink/pull/12170#discussion_r425763495



##########
File path: flink-yarn/src/main/java/org/apache/flink/yarn/YarnApplicationFileUploader.java
##########
@@ -300,19 +310,22 @@ public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes at
 
 		final ArrayList<String> classPaths = new ArrayList<>();
 		providedSharedLibs.forEach(
-			(fileName, fileStatus) -> {
-				localResources.put(
-					fileName,
-					Utils.registerLocalResource(
-						fileStatus.getPath(),
-						fileStatus.getLen(),
-						fileStatus.getModificationTime(),
-						LocalResourceVisibility.PUBLIC));
-
-				if (!isFlinkDistJar(fileName)) {
-					classPaths.add(fileName);
-				}
-			});
+				(fileName, fileStatus) -> {
+					final Path filePath = fileStatus.getPath();
+					LOG.debug("Using remote file {} to register local resource", filePath);
+
+					final YarnLocalResourceDescriptor descriptor = YarnLocalResourceDescriptor
+							.fromFileStatus(fileName, fileStatus, LocalResourceVisibility.PUBLIC);
+					localResources.put(fileName, descriptor.toLocalResource());
+					remotePaths.add(filePath);
+					envShipResourceList.add(descriptor);
+
+					if (!isFlinkDistJar(fileName) && !isPlugin(fileStatus.getPath())) {

Review comment:
       I think we could not use `fileName` to check `isFlinkDistJar ` since it is relative path, not the real file name(e.g. lib/flink-dist_2.11-1.11-SNAPSHOT.jar). So i suggest to use the `key` or `relative` to instead of `fileName` to avoid confusing.
   
   `fileStatus.getPath()` could be replaced with `filePath`.

##########
File path: flink-yarn/src/main/java/org/apache/flink/yarn/YarnApplicationFileUploader.java
##########
@@ -367,6 +380,18 @@ private static boolean isFlinkDistJar(String fileName) {
 		return fileName.startsWith("flink-dist") && fileName.endsWith("jar");
 	}
 
+	private static boolean isPlugin(Path path) {
+		Path parent = path.getParent();
+		while (parent != null) {
+			if (parent.getName().equals("plugins")) {

Review comment:
       "plugins" could be replaced with `ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org