You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/11 09:49:20 UTC

[GitHub] [spark] pan3793 opened a new pull request, #38205: [SPARK-40747] Support setting driver log url using env vars other than standalone mode

pan3793 opened a new pull request, #38205:
URL: https://github.com/apache/spark/pull/38205

   <!--
   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
        'core/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 pulls out the `getDriverLogUrls` from `StandaloneSchedulerBackend` to superclass `CoarseGrainedSchedulerBackend`, to make it support setting driver log url by env vars w/ prefix `SPARK_DRIVER_LOG_URL_` other than standalone mode, especially for K8s.
   
   ### 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.
   -->
   
   Since it has such an ability for the executor on K8s mode, we want to align the ability for the driver.
   
   The related code in `CoarseGrainedExecutorBackend`
   ```
     def extractLogUrls: Map[String, String] = {
       val prefix = "SPARK_LOG_URL_"
       sys.env.filterKeys(_.startsWith(prefix))
         .map(e => (e._1.substring(prefix.length).toLowerCase(Locale.ROOT), e._2)).toMap
     }
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   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'.
   -->
   Yes, the user code set the log url by env vars.
   
   ### 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.
   -->
   Existing UT, if it's not sufficient and the approach is accepted, will add more ut later


-- 
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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38205:
URL: https://github.com/apache/spark/pull/38205#discussion_r993040890


##########
core/src/main/scala/org/apache/spark/scheduler/SchedulerBackend.scala:
##########
@@ -73,7 +75,12 @@ private[spark] trait SchedulerBackend {
    * Executors tab for the driver.
    * @return Map containing the log names and their respective URLs
    */
-  def getDriverLogUrls: Option[Map[String, String]] = None
+  def getDriverLogUrls: Option[Map[String, String]] = {

Review Comment:
   Shall we explicitly mention the target resource managers instead of `Support setting driver log url using env vars on other resource managers` because `YarnClusterSchedulerBackend` will not use this implementation?
   
   https://github.com/apache/spark/blob/b9998cf1bf3501936bdf7c0d2a8cc3ddf0115a06/resource-managers/yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnClusterSchedulerBackend.scala#L38-L40



-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1289847809

   @mridulm Yes, https://github.com/apache/spark/pull/38357 is the proposed version.
   
   I opened this PR mostly for collecting feedback in case the community has another idea.


-- 
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


[GitHub] [spark] pan3793 commented on a diff in pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38205:
URL: https://github.com/apache/spark/pull/38205#discussion_r993046862


##########
core/src/main/scala/org/apache/spark/scheduler/SchedulerBackend.scala:
##########
@@ -73,7 +75,12 @@ private[spark] trait SchedulerBackend {
    * Executors tab for the driver.
    * @return Map containing the log names and their respective URLs
    */
-  def getDriverLogUrls: Option[Map[String, String]] = None
+  def getDriverLogUrls: Option[Map[String, String]] = {

Review Comment:
   It makes sense if we want to keep YARN as-is, another direction is to let Yarn support it then it works on all resource managers.
   
   The pseudo-code would like
   ```
   override def getDriverLogUrls: Option[Map[String, String]] = { 
      YarnContainerInfoHelper.getLogUrls(sc.hadoopConfiguration, container = None) ++
        super.getDriverLogUrls.getOrElse(Map.empty))
    } 
   ```



-- 
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


[GitHub] [spark] mridulm commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
mridulm commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1289465582

   I tagged @tgravescs on #38357, assuming that is the version that will get supported - or is this what we are looking at ?


-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1274887897

   To make it flexible, I'm planning to add the variable substitution support to the log URL just like SPARK-26311 does, and let the cluster manager exposes some attributes.
   
   For example, suppose exposing `APP_ID`, `KUBERNETES_POD_NAME` in K8s, then the user could integrate to external log service easily.
   
   ```
   spark-submit \
     --master=k8s://api-server:1234 \
     --deployMode=cluster \
     --conf spark.kubernetes.driverEnv.SPARK_DRIVER_LOG_URL_log=https://spark-log-svc:8080/?app_id={{APP_ID}}&pod_name={{KUBERNETES_POD_NAME}} \
     --conf spark.executorEnv.SPARK_LOG_URL_log=https://spark-log-svc:8080/?app_id={{APP_ID}}&pod_name={{KUBERNETES_POD_NAME}}
   ```


-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1324476298

   Close and in favor https://github.com/apache/spark/pull/38357


-- 
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


[GitHub] [spark] tgravescs commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
tgravescs commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1290675461

   Please link the 2 and I would prefer to see this in draft if it isn't meant to be the real solution and just looking for feedback.  The jira's should ideally be linked 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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1274446410

   cc @HeartSaVioR, would you please take a look? BTW, it does not work on Yarn since `YarnClusterSchedulerBackend`/`YarnCoarseGrainedExecutorBackend` override the methods `getDriverLogUrls`/`getExecutorLogUrls`.


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1275073651

   Can one of the admins verify this patch?


-- 
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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38205:
URL: https://github.com/apache/spark/pull/38205#discussion_r993052278


##########
core/src/main/scala/org/apache/spark/scheduler/SchedulerBackend.scala:
##########
@@ -73,7 +75,12 @@ private[spark] trait SchedulerBackend {
    * Executors tab for the driver.
    * @return Map containing the log names and their respective URLs
    */
-  def getDriverLogUrls: Option[Map[String, String]] = None
+  def getDriverLogUrls: Option[Map[String, String]] = {

Review Comment:
   Do you happen to know any instances where the production YARN clusters use the external log services?



-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1275671397

   > This PR seems to aiming only K8s because YARN is not using this and Mesos is not used in these days. May I ask why don't we have this in `KubernetesClusterSchedulerBackend` only?
   
   I think it could be a generic way for all cluster managers, and if it's overkill, it's fine to support this feature in `KubernetesClusterSchedulerBackend`.


-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1288120584

   Hi @dongjoon-hyun, I implement the proposed idea in https://github.com/apache/spark/pull/38357, w/ the doc https://docs.google.com/document/d/1MfB39LD4B4Rp7MDRxZbMKMbdNSe6V6mBmMQ-gkCnM-0/edit?usp=sharing, would you please take a look when you have time?


-- 
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


[GitHub] [spark] pan3793 closed pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 closed pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers
URL: https://github.com/apache/spark/pull/38205


-- 
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


[GitHub] [spark] pan3793 commented on a diff in pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38205:
URL: https://github.com/apache/spark/pull/38205#discussion_r993046862


##########
core/src/main/scala/org/apache/spark/scheduler/SchedulerBackend.scala:
##########
@@ -73,7 +75,12 @@ private[spark] trait SchedulerBackend {
    * Executors tab for the driver.
    * @return Map containing the log names and their respective URLs
    */
-  def getDriverLogUrls: Option[Map[String, String]] = None
+  def getDriverLogUrls: Option[Map[String, String]] = {

Review Comment:
   It makes sense if we want to keep YARN as-is, another direction is to let Yarn support it then it works on all resource managers.
   
   The pseudo-code would like
   ```
   override def getDriverLogUrls: Option[Map[String, String]] = { 
      YarnContainerInfoHelper.getLogUrls(sc.hadoopConfiguration, container = None) ++
        super.getDriverAttributes.getOrElse(Map.empty))
    } 
   ```



-- 
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


[GitHub] [spark] pan3793 commented on pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38205:
URL: https://github.com/apache/spark/pull/38205#issuecomment-1275498674

   @dongjoon-hyun @holdenk what do think about the plan? is it the right direction to support the external log service on K8s?


-- 
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


[GitHub] [spark] pan3793 commented on a diff in pull request #38205: [SPARK-40747][CORE] Support setting driver log url using env vars on other resource managers

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38205:
URL: https://github.com/apache/spark/pull/38205#discussion_r993054097


##########
core/src/main/scala/org/apache/spark/scheduler/SchedulerBackend.scala:
##########
@@ -73,7 +75,12 @@ private[spark] trait SchedulerBackend {
    * Executors tab for the driver.
    * @return Map containing the log names and their respective URLs
    */
-  def getDriverLogUrls: Option[Map[String, String]] = None
+  def getDriverLogUrls: Option[Map[String, String]] = {

Review Comment:
   it was mentioned in SPARK-26311



-- 
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