iemejia commented on a change in pull request #14520:
URL: https://github.com/apache/beam/pull/14520#discussion_r613740376
##########
File path:
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/resources/PipelineResources.java
##########
@@ -64,6 +70,31 @@
return resourcePath -> !resourcePath.contains("gradle/wrapper");
}
+ /**
+ * Goes through the list of files that need to be staged on runner. Removes
nonexistent
+ * directories and packages existing ones. This is necessary for runners
that require filesToStage
+ * to be jars only.
+ *
+ * @param options options object with the files to stage and temp location
for staging
+ */
+ public static void prepareFilesForStaging(FileStagingOptions options) {
+ List<String> filesToStage = options.getFilesToStage();
+ if (filesToStage == null || filesToStage.isEmpty()) {
+ filesToStage =
detectClassPathResourcesToStage(ReflectHelpers.findClassLoader(), options);
+ LOG.info(
+ "PipelineOptions.filesToStage was not specified. "
+ + "Defaulting to files from the classpath: will stage {} files. "
+ + "Enable logging at DEBUG level to see which files will be
staged.",
+ filesToStage.size());
+ LOG.debug("Classpath elements: {}", filesToStage);
+ }
+ options.setFilesToStage(
+ PipelineResources.prepareFilesForStaging(
Review comment:
Oups sorry we can't because it is used for tests not only in
`PipelineResourcesTest` but also in
`FlinkPipelineExecutionEnvironmentTest#testPreparingResourcesToStage(java.lang.String,
boolean, boolean)`. I propose that we let it as it is. This is a runners
Internal API and little harm can be done from the second method (used mostly
for tests) that is immutable versus the big one who is mutable and is the one
we are using all around.
--
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:
[email protected]