You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "TongWei1105 (via GitHub)" <gi...@apache.org> on 2025/12/01 06:37:02 UTC
[PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
TongWei1105 opened a new pull request, #51037:
URL: https://github.com/apache/spark/pull/51037
…rking directory after they are downloaded.
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
This PR fixes a bug where submitting a Spark job using the --files option and also calling SparkContext.addFile() for a file with the same name causes Spark to throw an exception
`Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: File a.text was already registered with a different path (old path = /tmp/spark-6aa5129d-5bbb-464a-9e50-5b6ffe364ffb/a.text, new path = /opt/spark/work-dir/a.text`
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
1. Submit a Spark application using spark-submit with the --files option:
`bin/spark-submit --files s3://bucket/a.text --class testDemo app.jar `
2. In the testDemo application code, call:
`sc.addFile("a.text", true)`
This works correctly in YARN mode, but throws an error in Kubernetes mode.
After [SPARK-33782](https://issues.apache.org/jira/browse/SPARK-33782), in Kubernetes mode, --files, --jars, --archiveFiles, and --pyFiles are all downloaded to the working directory.
However, in the code, args.files = filesLocalFiles, and filesLocalFiles refers to a temporary download path, not the working directory.
This causes issues when user code like testDemo calls sc.addFile("a.text", true), resulting in an error such as:
`Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: File a.text was already registered with a different path (old path = /tmp/spark-6aa5129d-5bbb-464a-9e50-5b6ffe364ffb/a.text, new path = /opt/spark/work-dir/a.text`
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
This issue can be resolved after this PR.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
Existed UT
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
no
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2123280444
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
> `log4j2.properties` is not an archive file - and so ends up getting copied for destination (variant of existing cases). I am trying to ensure that `if (isArchive) {` works as expected when the file actually results in unpacking the file
hi, @mridulm
The isArchive logic does get triggered in this case — the test has been updated to cover that scenario accordingly.
Thank you for your suggestion.
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
> `log4j2.properties` is not an archive file - and so ends up getting copied for destination (variant of existing cases). I am trying to ensure that `if (isArchive) {` works as expected when the file actually results in unpacking the file
hi, @mridulm
The isArchive logic does get triggered in this case — the test has been updated to cover that scenario accordingly.
Thank you for your suggestion.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-3615888953
> The main body itself looks good to me.
>
> Please try to avoid new binary file like, `archive1.zip`. You can create it simply like the following, @TongWei1105 .
>
> https://github.com/apache/spark/blob/7e53ce8c36473eea209f1188d26de3e01c071a43/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala#L698-L699
@dongjoon-hyun done
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-2942520836
When you have a moment, could you please take another look at this PR? Thanks!
@dongjoon-hyun @mridulm
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-2918754991
> Do you think you can write a test case, @TongWei1105 ?
Thanks for the suggestion! I've added a unit test,please feel free to review it when convenient. Appreciate your feedback!
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 closed pull request #51037: [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded
URL: https://github.com/apache/spark/pull/51037
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-3615049014
Sorry guys for missing ping here. I can test this Today.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2576512540
##########
core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala:
##########
@@ -448,14 +448,16 @@ private[spark] class SparkSubmit extends Logging {
log" from ${MDC(LogKeys.SOURCE_PATH, source)}" +
log" to ${MDC(LogKeys.DESTINATION_PATH, dest)}")
Utils.deleteRecursively(dest)
- if (isArchive) {
+ val resourceUri = if (isArchive) {
Utils.unpack(source, dest)
+ localResources
} else {
Files.copy(source.toPath, dest.toPath)
+ dest.toURI
Review Comment:
> Can you explain how this fixes the issue?
Thank you for your reply.
In Kubernetes mode, when using --files or --jars, Spark first stores a copy under the local /tmp directory and also copies it to /opt/spark/work-dir/. However, when addFile(file) is called a second time inside the SparkContext, the file path becomes /opt/spark/work-dir/file. In NettyStreamManager, however, the file entries are still recorded using the original /tmp path, so when it tries to guard against duplicate file registrations, a mismatch occurs and an exception is thrown.
Therefore, I believe that in Kubernetes mode, these paths should be unified to /opt/spark/work-dir/.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2122666634
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
> Can you update this test to handle archive as well ?
Done
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 closed pull request #51037: [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded
URL: https://github.com/apache/spark/pull/51037
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2123281383
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
> `log4j2.properties` is not an archive file - and so ends up getting copied for destination (variant of existing cases). I am trying to ensure that `if (isArchive) {` works as expected when the file actually results in unpacking the file
The isArchive logic does get triggered in this case — the test has been updated to cover that scenario accordingly.
Thank you for your suggestion.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2120193707
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
Can you update this test to handle archive as well ?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-2993804690
The change looks reasonable to me.
I would prefer if someone more familiar with k8s also takes a look.
+CC @dongjoon-hyun , @HyukjinKwon
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-3614993273
@dongjoon-hyun , when you're free, could you help me review this?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2120193707
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
Can you update this test to handle archive as well ? Given that is in a different branch ?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2122771509
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1809,6 +1809,39 @@ class SparkSubmitSuite
assert(classpath.contains("."))
}
+ test("SPARK-52334: Update all files, jars, and pyFiles to" +
+ "reference the working directory after they are downloaded") {
+ val testFile = "test_metrics_config.properties"
+ val testPyFile = "test_metrics_system.properties"
+ val testJar = "TestUDTF.jar"
+ val clArgs = Seq(
+ "--deploy-mode", "client",
+ "--proxy-user", "test.user",
+ "--master", "k8s://host:port",
+ "--executor-memory", "5g",
+ "--class", "org.SomeClass",
+ "--driver-memory", "4g",
+ "--conf", "spark.kubernetes.namespace=spark",
+ "--conf", "spark.kubernetes.driver.container.image=bar",
+ "--conf", "spark.kubernetes.submitInDriver=true",
+ "--files", s"src/test/resources/$testFile",
+ "--py-files", s"src/test/resources/$testPyFile",
+ "--jars", s"src/test/resources/$testJar",
+ "/home/thejar.jar",
+ "arg1")
+ val appArgs = new SparkSubmitArguments(clArgs)
+ val _ = submit.prepareSubmitEnvironment(appArgs)
Review Comment:
`log4j2.properties` is not an archive file - and so ends up getting copied for destination (variant of existing cases).
I am trying to ensure that `if (isArchive) {` works as expected when the file actually results in unpacking the file
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2575813849
##########
core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala:
##########
@@ -448,14 +448,16 @@ private[spark] class SparkSubmit extends Logging {
log" from ${MDC(LogKeys.SOURCE_PATH, source)}" +
log" to ${MDC(LogKeys.DESTINATION_PATH, dest)}")
Utils.deleteRecursively(dest)
- if (isArchive) {
+ val resourceUri = if (isArchive) {
Utils.unpack(source, dest)
+ localResources
} else {
Files.copy(source.toPath, dest.toPath)
+ dest.toURI
Review Comment:
Can you explain how this fixes the issue?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, archiveFiles, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "TongWei1105 (via GitHub)" <gi...@apache.org>.
TongWei1105 commented on PR #51037:
URL: https://github.com/apache/spark/pull/51037#issuecomment-2915053544
Hi @dongjoon-hyun ,
Could you please review this PR when you have time? Many thanks!
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2575812493
##########
core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala:
##########
@@ -448,14 +448,16 @@ private[spark] class SparkSubmit extends Logging {
log" from ${MDC(LogKeys.SOURCE_PATH, source)}" +
log" to ${MDC(LogKeys.DESTINATION_PATH, dest)}")
Utils.deleteRecursively(dest)
- if (isArchive) {
+ val resourceUri = if (isArchive) {
Utils.unpack(source, dest)
+ localResources
} else {
Files.copy(source.toPath, dest.toPath)
+ dest.toURI
Review Comment:
Using `dest.toURI`, we are placing the file names from the current working directory. I mean yeah this should also work but I wonder why we should do it.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #51037:
URL: https://github.com/apache/spark/pull/51037#discussion_r2575808482
##########
core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala:
##########
@@ -448,14 +448,16 @@ private[spark] class SparkSubmit extends Logging {
log" from ${MDC(LogKeys.SOURCE_PATH, source)}" +
log" to ${MDC(LogKeys.DESTINATION_PATH, dest)}")
Utils.deleteRecursively(dest)
- if (isArchive) {
+ val resourceUri = if (isArchive) {
Utils.unpack(source, dest)
+ localResources
} else {
Files.copy(source.toPath, dest.toPath)
+ dest.toURI
Review Comment:
Shouldn't it be `source.toURI`?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #51037: [SPARK-52334][CORE][K8S] update all files, jars, and pyFiles to reference the working directory after they are downloaded
URL: https://github.com/apache/spark/pull/51037
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org