You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by Sherry302 <gi...@git.apache.org> on 2016/08/16 04:45:00 UTC

[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

GitHub user Sherry302 opened a pull request:

    https://github.com/apache/spark/pull/14659

    [SPARK-16757] Set up Spark caller context to HDFS

    ## What changes were proposed in this pull request?
    
    1. Pass `jobId` to Task.
    2. Invoke Hadoop APIs. 
    
    A new function `setCallerContext` is added in `Utils`. `setCallerContext` function invokes APIs of   `org.apache.hadoop.ipc.CallerContext` to set up spark caller contexts, which will be written into `hdfs-audit.log`.
    
    For applications in Yarn client mode, `org.apache.hadoop.ipc.CallerContext` are called in `Task` and Yarn `Client`. For applications in Yarn cluster mode, `org.apache.hadoop.ipc.CallerContext` are be called in `Task` and `ApplicationMaster`.
    
    The Spark caller contexts written into `hdfs-audit.log` are applications' name` {spark.app.name}` and `JobID_stageID_stageAttemptId_taskID_attemptNumbe`.
    
    ## How was this patch tested?
    Manual Tests against some Spark applications in Yarn client mode and Yarn cluster mode. Need to check if spark caller contexts are written into HDFS hdfs-audit.log successfully.
    
    For example, run SparkKmeans in Yarn client mode: 
    `./bin/spark-submit  --master yarn --deploy-mode client --class org.apache.spark.examples.SparkKMeans examples/target/original-spark-examples_2.11-2.1.0-SNAPSHOT.jar hdfs://localhost:9000/lr_big.txt 2 5`
    
    Before:
    There will be no Spark caller context in records of `hdfs-audit.log`.
    
    After:
    Spark caller contexts will be in records of `hdfs-audit.log`.
    (_Note: spark caller context below since Hadoop caller context API was invoked in Yarn Client_)
    `2016-07-21 13:52:30,802 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=getfileinfo        src=/lr_big.txt        dst=null        perm=null        proto=rpc        callerContext=SparkKMeans running on Spark 
    `
    (_Note: spark caller context below since Hadoop caller context API was invoked in Task_)
    `2016-07-21 13:52:35,584 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open        src=/lr_big.txt        dst=null        perm=null        proto=rpc        callerContext=JobId_0_StageID_0_stageAttemptId_0_taskID_0_attemptNumber_0`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Sherry302/spark callercontextSubmit

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/14659.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14659
    
----
commit ec6833d32ef14950b2d81790bc908992f6288815
Author: Weiqing Yang <ya...@gmail.com>
Date:   2016-08-16T04:11:41Z

    [SPARK-16757] Set up Spark caller context to HDFS

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80239469
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    this is fine lets leave it as is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65677/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Jenkins test this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896707
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Thank you so much for the review. I have updated the PR based on your every comment.
    
    The only one question left is this one (in `Task`) "are these params all optional just to make it easier for different task types?" I have replied this. Could you check it again and give your opinion?
    
    To make the caller context more readable, at commit [10dbc6f](https://github.com/apache/spark/commit/10dbc6f26ac7d224803b721f32a9a0b4306e1f47), I added the static strings `AttemptId` back ( for stage, task and app) which had been deleted at commit [748e7a9](https://github.com/apache/spark/commit/748e7a9b6f6fe928df9e49f8e020d02126123be8).
    
    Yes, this PR will set up the caller context for both HDFS and YARN. At very beginning, to make the review easier, I created two different jiras to set up caller contexts for HDFS(SPARK-16757) and YARN (SPARK-16758) although the code is the same. I have updated the jiras, the title of this PR, and the description of this PR. In the \u201cHow was this patch tested\u201d of the PR\u2019s description, you can see what are showing in HDFS hdfs-audit.log and Yarn RM audit log. 
    
    When invoking Hadoop CallerContext API in Yarn Client, the caller context (including `SPARK_CLIENT` with AppId only) will be written to both HDFS audit log and Yarn RM audit log. 
    In hdfs-audit.log:
    ```
    2016-09-20 11:54:24,116 INFO FSNamesystem.audit: allowed=true   ugi=wyang (auth:SIMPLE) ip=/127.0.0.1   cmd=open    src=/lr_big.txt dst=null    perm=null   proto=rpc   callerContext=SPARK_CLIENT_AppId_application_1474394339641_0005
    ```
    In Yarn RM log:
    ```
    2016-09-20 11:59:24,050 INFO org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger: USER=wyang    IP=127.0.0.1    OPERATION=Submit Application Request    TARGET=ClientRMService  RESULT=SUCCESS  APPID=application_1474394339641_0006    CALLERCONTEXT=SPARK_CLIENT_AppId_application_1474394339641_0006
    ```
    Also, I have tested this with multiple tasks running in the same executor. Take `application_1474394339641_0006` as example.
    
    My command line to run tests as below:
    ```
    ./bin/spark-submit --verbose --executor-cores 3 --num-executors 1 --master yarn --deploy-mode client --class org.apache.spark.examples.SparkKMeans examples/target/original-spark-examples_2.11-2.1.0-SNAPSHOT.jar hdfs://localhost:9000/lr_big.txt 2 5
    ```
    In Spark History Application page, you can see there are two executors (one is driver), in the executor, there are 46 tasks:
    <img width="1411" alt="screen shot 2016-09-20 at 12 53 52 pm" src="https://cloud.githubusercontent.com/assets/8546874/18686920/a2617e70-7f32-11e6-947e-dfe83c4185e3.png">
    In HDFS audit log, there are 46 task records.:
    ```
    2016-09-20 11:59:33,868 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=mkdirs     src=/private/tmp/hadoop-wyang/nm-local-dir/usercache/wyang/appcache/application_1474394339641_0006/container_1474394339641_0006_01_000001/spark-warehouse        dst=null       perm=wyang:supergroup:rwxr-xr-x       proto=rpc        callerContext=SPARK_APPLICATION_MASTER_AppId_application_1474394339641_0006_AttemptId_1
    2016-09-20 11:59:37,214 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_1_AttemptNum_0
    2016-09-20 11:59:37,215 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_2_AttemptNum_0
    2016-09-20 11:59:37,215 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_0_AttemptNum_0
    2016-09-20 11:59:42,391 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_3_AttemptNum_0
    2016-09-20 11:59:42,432 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_4_AttemptNum_0
    2016-09-20 11:59:42,445 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_5_AttemptNum_0
    2016-09-20 11:59:46,720 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_6_AttemptNum_0
    2016-09-20 11:59:46,735 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_7_AttemptNum_0
    2016-09-20 11:59:46,739 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_8_AttemptNum_0
    2016-09-20 11:59:50,915 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_9_AttemptNum_0
    2016-09-20 11:59:50,932 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_10_AttemptNum_0
    2016-09-20 11:59:50,934 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_10_AttemptNum_0
    2016-09-20 11:59:50,941 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_11_AttemptNum_0
    2016-09-20 11:59:50,943 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_11_AttemptNum_0
    2016-09-20 11:59:54,757 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_9_AttemptNum_0
    2016-09-20 11:59:54,774 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_12_AttemptNum_0
    2016-09-20 11:59:54,776 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_12_AttemptNum_0
    2016-09-20 11:59:54,799 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_13_AttemptNum_0
    2016-09-20 11:59:54,803 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_13_AttemptNum_0
    2016-09-20 11:59:54,812 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_14_AttemptNum_0
    2016-09-20 11:59:54,814 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_14_AttemptNum_0
    2016-09-20 11:59:59,024 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_15_AttemptNum_0
    2016-09-20 11:59:59,025 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_15_AttemptNum_0
    2016-09-20 11:59:59,044 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_16_AttemptNum_0
    2016-09-20 11:59:59,046 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_16_AttemptNum_0
    2016-09-20 11:59:59,059 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_17_AttemptNum_0
    2016-09-20 11:59:59,060 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_17_AttemptNum_0
    2016-09-20 12:00:03,065 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_18_AttemptNum_0
    2016-09-20 12:00:03,066 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_18_AttemptNum_0
    2016-09-20 12:00:03,107 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_19_AttemptNum_0
    2016-09-20 12:00:03,107 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_20_AttemptNum_0
    2016-09-20 12:00:03,108 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_20_AttemptNum_0
    2016-09-20 12:00:03,109 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_19_AttemptNum_0
    2016-09-20 12:00:07,359 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_22_AttemptNum_0
    2016-09-20 12:00:07,360 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_22_AttemptNum_0
    2016-09-20 12:00:07,366 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_21_AttemptNum_0
    2016-09-20 12:00:07,367 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_21_AttemptNum_0
    2016-09-20 12:00:11,076 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_27_AttemptNum_0
    2016-09-20 12:00:11,094 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_28_AttemptNum_0
    2016-09-20 12:00:11,094 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_29_AttemptNum_0
    2016-09-20 12:00:15,082 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_30_AttemptNum_0
    2016-09-20 12:00:15,094 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_31_AttemptNum_0
    2016-09-20 12:00:15,189 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_32_AttemptNum_0
    2016-09-20 12:00:19,481 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_33_AttemptNum_0
    2016-09-20 12:00:19,530 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_34_AttemptNum_0
    2016-09-20 12:00:19,532 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_34_AttemptNum_0
    2016-09-20 12:00:19,620 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_35_AttemptNum_0
    2016-09-20 12:00:19,621 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_35_AttemptNum_0
    2016-09-20 12:00:24,193 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_33_AttemptNum_0
    2016-09-20 12:00:24,210 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_36_AttemptNum_0
    2016-09-20 12:00:24,211 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_36_AttemptNum_0
    2016-09-20 12:00:24,279 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_37_AttemptNum_0
    2016-09-20 12:00:24,281 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_37_AttemptNum_0
    2016-09-20 12:00:24,303 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_38_AttemptNum_0
    2016-09-20 12:00:24,305 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_38_AttemptNum_0
    2016-09-20 12:00:29,118 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_39_AttemptNum_0
    2016-09-20 12:00:29,120 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_39_AttemptNum_0
    2016-09-20 12:00:29,149 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_40_AttemptNum_0
    2016-09-20 12:00:29,151 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_40_AttemptNum_0
    2016-09-20 12:00:29,161 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_41_AttemptNum_0
    2016-09-20 12:00:29,163 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_41_AttemptNum_0
    2016-09-20 12:00:33,143 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_42_AttemptNum_0
    2016-09-20 12:00:33,144 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_43_AttemptNum_0
    2016-09-20 12:00:33,144 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_42_AttemptNum_0
    2016-09-20 12:00:33,145 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_43_AttemptNum_0
    2016-09-20 12:00:33,184 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_44_AttemptNum_0
    2016-09-20 12:00:33,185 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_44_AttemptNum_0
    2016-09-20 12:00:37,142 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_45_AttemptNum_0
    2016-09-20 12:00:37,144 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=open       src=/lr_big.txt dst=null       perm=null      proto=rpc callerContext=SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_1_StageId_1_AttemptId_0_TaskId_45_AttemptNum_0
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78758789
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ShuffleMapTask.scala ---
    @@ -51,8 +51,12 @@ private[spark] class ShuffleMapTask(
         partition: Partition,
         @transient private var locs: Seq[TaskLocation],
         metrics: TaskMetrics,
    -    localProperties: Properties)
    -  extends Task[MapStatus](stageId, stageAttemptId, partition.index, metrics, localProperties)
    +    localProperties: Properties,
    --- End diff --
    
    update descriptions and params in java doc above


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/64380/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    I'm not sure I know enough about the APIs and need for this to say I would review and merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    The only failure is 'basic functionality', but it passed locally. I'll re-trigger again.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65427 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65427/consoleFull)** for PR 14659 at commit [`748e7a9`](https://github.com/apache/spark/commit/748e7a9b6f6fe928df9e49f8e020d02126123be8).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @srowen . Thank you so much for the review. Sorry for the test
    failure and late update. The failure reasons are that \u2018jobID\u2019 were
    none or there was no \u2018spark.app.name\u2019 in sparkConf. I have updated the PR to set
    default values to \u2018jobID\u2019 and \u2018spark.app.name\u2019. When a real application runs on
    Spark, it will always have \u2018jobID\u2019 and \u2018spark.app.name\u2019. 
    
    What's the use case for this?
    When users run Spark applications on Yarn on HDFS, Spark\u2019s
    caller contexts will be written into hdfs-audit.log. The Spark caller contexts
    are JobID_stageID_stageAttemptId_taskID_attemptNumbe and applications\u2019 name. 
    
    The caller context can help users to better diagnose and understand how specific
    applications impacting parts of the Hadoop system and potential problems they
    may be creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a
    given HDFS operation, it's very helpful to track which upper level job issues
    it. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by cnauroth <gi...@git.apache.org>.
Github user cnauroth commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Actually a HADOOP JIRA... I filed [HADOOP-13528](https://issues.apache.org/jira/browse/HADOOP-13528) for follow-up.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65677 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65677/consoleFull)** for PR 14659 at commit [`10dbc6f`](https://github.com/apache/spark/commit/10dbc6f26ac7d224803b721f32a9a0b4306e1f47).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78767856
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    --- End diff --
    
    perhaps name something other then ret, perhaps hdfsContext 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78758711
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ResultTask.scala ---
    @@ -51,8 +51,12 @@ private[spark] class ResultTask[T, U](
         locs: Seq[TaskLocation],
         val outputId: Int,
         localProperties: Properties,
    -    metrics: TaskMetrics)
    -  extends Task[U](stageId, stageAttemptId, partition.index, metrics, localProperties)
    +    metrics: TaskMetrics,
    +    jobId: Option[Int] = None,
    --- End diff --
    
    you need to update the description of this class to have new params and descriptions


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs [SPARK-17714](https://issues.apache.org/jira/browse/SPARK-17714) has been created for further investigation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65799/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    having some problems adding you as a contributor; JIRA scale issues, browser problems &c, I've asked others to try and do it. Start with the coding; I'll sort out the contributor entry 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65934 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65934/consoleFull)** for PR 14659 at commit [`dbcabfc`](https://github.com/apache/spark/commit/dbcabfc3ff0d14c1a0a77daddc7751a77ec6d241).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/14659


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    There is "0 failures (�0)" in the Test Result page. All tests passed. I'll re-trigger again.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78767418
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    It might be nice to do this first outside of this try block and it the class isn't found we just skip the rest of this and assume its before hadoop 2.8.0


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Thank you very much. Yes. I have updated the PR to make the string of the caller context shorter. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78767924
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    +      callerContext.getMethod("setCurrent", callerContext).invoke(null, ret)
    +      succeed = true
    +    } catch {
    +      case NonFatal(e) => logDebug(s"$e", e)
    --- End diff --
    
    why are you printing exception twice here.  make the actual log message something like failed to set CallerContext and leave the Exception to print after ,e


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79421792
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    +   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    +   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    +   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    +   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    +   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val TaskId = if (taskId.isDefined) s"_TaskId_${taskId.get}" else ""
    +   val TaskAttemptNumber = if (taskAttemptNumber.isDefined) s"_${taskAttemptNumber.get}" else ""
    +
    +   val context = "SPARK" + AppName + AppID + AppAttemptID +
    +     JobID + StageID + StageAttemptId + TaskId + TaskAttemptNumber
    +
    +  def set(): Boolean = {
    --- End diff --
    
    Let rename this to setCurrentContext().


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Could you please review this PR? Thank you very much.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by cnauroth <gi...@git.apache.org>.
Github user cnauroth commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    > Chris: maybe the CallerContext class could check for bad characters, including spaces, newlines, "," and quotation marks .. the usual things to break parsers.
    
    Yes, good conversation to have over in HDFS JIRA.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs @srowen 
    Give an intermediate update, If using `Class.forName  `instead of Utils.classForName`, Maven build and all of the tests will be passed. 
    
    ```
      def setCurrentContext(): Boolean = {
        var succeed = false
        try {
          // scalastyle:off classforname
          val callerContext = Class.forName("org.apache.hadoop.ipc.CallerContext")
          val Builder = Class.forName("org.apache.hadoop.ipc.CallerContext$Builder")
          // scalastyle:on classforname
          val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
          val hdfsContext = Builder.getMethod("build").invoke(builderInst)
          callerContext.getMethod("setCurrent", callerContext).invoke(null, hdfsContext)
          succeed = true
        } catch {
          case NonFatal(e) => logInfo("Fail to set Spark caller context", e)
        }
        succeed
      }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @steveloughran Thank you very much for the comments. I have created an Hadoop jira [HADOOP-13527 ](https://issues.apache.org/jira/browse/HADOOP-13527) and attached the patch, could you please review it? I am unable to assign the jira to me, could you please add me as \u201ccontributor\u201d role in Hadoop? Thanks again.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79403168
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    +   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    +   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    +   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    +   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    +   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val TaskId = if (taskId.isDefined) s"_TaskId_${taskId.get}" else ""
    +   val TaskAttemptNumber = if (taskAttemptNumber.isDefined) s"_${taskAttemptNumber.get}" else ""
    +
    +   val context = "SPARK" + AppName + AppID + AppAttemptID +
    +     JobID + StageID + StageAttemptId + TaskId + TaskAttemptNumber
    +
    +  def set(): Boolean = {
    +    var succeed = false
    +    try {
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    can you add a comment that this api was added in hadoop 2.8


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65422 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65422/consoleFull)** for PR 14659 at commit [`4fc8c79`](https://github.com/apache/spark/commit/4fc8c799894fe265f96250e567377c1bf2702617).
     * This patch **fails build dependency tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896928
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    +        s"_JobId_${jobId.getOrElse("0")}_StageID_${stageId}_stageAttemptId_${stageAttemptId}" +
    +        s"_taskID_${taskAttemptId}_attemptNumber_${attemptNumber}"
    --- End diff --
    
    I have updated the PR to make the string shorter.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Thank you very much for the review. I have updated the PR based on your every comment, including adding a CallerContext class, updating java doc, and made the caller context string shorter, etc. Manual Tests against some Spark applications in Yarn client mode and Yarn cluster mode, and spark caller contexts are written into HDFS `hdfs-audit.log` successfully.
    
    The following is the screenshot of the audit log (SparkKMeans in yarn client mode):
    
    <img width="1407" alt="screen shot 2016-09-14 at 10 34 25 pm" src="https://cloud.githubusercontent.com/assets/8546874/18539563/1eb16748-7acd-11e6-840a-0e8bfabf5954.png">
    
    This is the caller context which was written into `hdfs-audit.log` by `Yarn Client`:
    ```
    2016-09-14 22:28:59,341 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=getfileinfo	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppName_SparkKMeans_AppID_application_1473908768790_0007
    ```
    The callerContext above is `SPARK_AppName_***_AppID_***`
    
    These are the caller contexts which were written into `hdfs-audit.log` by `Task`:
    ```
    2016-09-14 22:29:06,525 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0007_JobID_0_StageID_0_0_TaskId_1_0
    2016-09-14 22:29:06,526 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0007_JobID_0_StageID_0_0_TaskId_0_0
    2016-09-14 22:29:06,526 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0007_JobID_0_StageID_0_0_TaskId_2_0
    ```
    The callContext above is `SPARK_AppID_***_JobID_***_StageID_***_(StageAttemptID)_TaskId_***_(TaskAttemptNumber)`. The static strings `jobAttemptID`, `stageAttemptID`, and `attemptNumber` of tasks have been deleted. (For `jobAttemptID`, please refer the following records produced by SparkKMeans ran in Yarn cluster mode)
    
    The records below were written into `hdfs-audit.log` when SparkKMeans ran in Yarn cluster mode:
    
    ```
    2016-09-14 22:25:30,100 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=mkdirs	src=/private/tmp/hadoop-wyang/nm-local-dir/usercache/wyang/appcache/application_1473908768790_0006/container_1473908768790_0006_01_000001/spark-warehouse	dst=null	perm=wyang:supergroup:rwxr-xr-x	proto=rpc	callerContext=SPARK_AppName_org.apache.spark.examples.SparkKMeans_AppID_application_1473908768790_0006_1
    2016-09-14 22:25:33,635 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0006_1_JobID_0_StageID_0_0_TaskId_0_0
    2016-09-14 22:25:33,635 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0006_1_JobID_0_StageID_0_0_TaskId_2_0
    2016-09-14 22:25:33,635 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=SPARK_AppID_application_1473908768790_0006_1_JobID_0_StageID_0_0_TaskId_1_0
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Couple minor things otherwise looks good.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @Sherry302 @tgravescs oops it looks like this causes master Maven builds to fail:
    
    https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Test%20(Dashboard)/
    https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Test%20(Dashboard)/job/spark-master-test-maven-hadoop-2.3/2000/consoleFull
    
    But not the SBT ones, weird. And it fails REPL tests, with an odd error. I don't know what's actually going on there.
    
    ```
    Lost task 0.0 in stage 0.0 (TID 0, localhost): java.lang.ClassCircularityError: io/netty/util/internal/__matchers__/org/apache/spark/network/protocol/MessageMatcher
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:348)
      	at io.netty.util.internal.JavassistTypeParameterMatcherGenerator.generate(JavassistTypeParameterMatcherGenerator.java:62)
      	at io.netty.util.internal.JavassistTypeParameterMatcherGenerator.generate(JavassistTypeParameterMatcherGenerator.java:54)
      	at io.netty.util.internal.TypeParameterMatcher.get(TypeParameterMatcher.java:42)
      	at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:78)
      	at io.netty.handler.codec.MessageToMessageEncoder.<init>(MessageToMessageEncoder.java:59)
      	at org.apache.spark.network.protocol.MessageEncoder.<init>(MessageEncoder.java:34)
      	at org.apache.spark.network.TransportContext.<init>(TransportContext.java:78)
      	at org.apache.spark.rpc.netty.NettyRpcEnv.downloadClient(NettyRpcEnv.scala:354)
      	at org.apache.spark.rpc.netty.NettyRpcEnv.openChannel(NettyRpcEnv.scala:324)
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64380 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64380/consoleFull)** for PR 14659 at commit [`1512775`](https://github.com/apache/spark/commit/1512775a3faddb9de9299662a6f3bfec3f6fe205).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Could you please review this again? I have updated the PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    also just to verify , did you test this with multiple tasks running in the same executor?  Just want to make sure the audit log showed each task properly


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Retest this please.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65445 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65445/consoleFull)** for PR 14659 at commit [`748e7a9`](https://github.com/apache/spark/commit/748e7a9b6f6fe928df9e49f8e020d02126123be8).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79695565
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    --- End diff --
    
    Yes. Done. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Thanks a lot for the review. @tgravescs @cnauroth @steveloughran @srowen 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78783274
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    +        s"_JobId_${jobId.getOrElse("0")}_StageID_${stageId}_stageAttemptId_${stageAttemptId}" +
    +        s"_taskID_${taskAttemptId}_attemptNumber_${attemptNumber}"
    --- End diff --
    
    one concern I have about this is the length of the string.  This string is going to be sent on every hadoop RPC call and then I believe get into the hdfs audit log.  The audit log does have a config to truncate it (default 128) but it still gets sent over rpc.  So I would like to keep this string as small as possible while still being useful.  The one above seems very long to me since just the static string is like 90 characters.  So I would like to see some of those static strings removed or abbreviated. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78773807
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    --- End diff --
    
    can you change Spark to all caps "SPARK"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    So correct me if I'm missing something but this is actually going to set the caller context for everything (HDFS and YARN) correct?  The caller context is a static thing you set and its just passed with the rpc so this pr is actually for both.  What is the yarn audit log showing for this?  I don't currently have a hadoop 2.8 to try this.
    We should update the jira and title of this to reflect.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by cnauroth <gi...@git.apache.org>.
Github user cnauroth commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    +1 (non-binding) for the latest revision.  I think this is an improvement, speaking from the perspective of the HDFS audit log.  Thank you, @Sherry302 .  :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @srowen Could you please review this PR again? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65677 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65677/consoleFull)** for PR 14659 at commit [`10dbc6f`](https://github.com/apache/spark/commit/10dbc6f26ac7d224803b721f32a9a0b4306e1f47).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78898257
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    If make `val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")` out of `try` block, Spark will throw exception when it runs on hadoop before 2.8.0. Also, moving that line to the first of `try` block does not make any difference since `Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")` also needs to check if `org.apache.hadoop.ipc.CallerContext` exists. I am not sure if I got your point, could you please give more info about it? Thanks a lot.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65427/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65934 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65934/consoleFull)** for PR 14659 at commit [`dbcabfc`](https://github.com/apache/spark/commit/dbcabfc3ff0d14c1a0a77daddc7751a77ec6d241).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80482539
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2421,6 +2421,69 @@ private[spark] object Utils extends Logging {
     }
     
     /**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPMASTER)
    + *
    + * The parameters below are optional:
    + * @param appId id of the app this task belongs to
    + * @param appAttemptId attempt id of the app this task belongs to
    + * @param jobId id of the job this task belongs to
    + * @param stageId id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    --- End diff --
    
    sorry I missed this before, this is new feature and will only go into 2.1, lets just remove the @since since this isn't public api


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #63910 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/63910/consoleFull)** for PR 14659 at commit [`ec6833d`](https://github.com/apache/spark/commit/ec6833d32ef14950b2d81790bc908992f6288815).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64372 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64372/consoleFull)** for PR 14659 at commit [`1512775`](https://github.com/apache/spark/commit/1512775a3faddb9de9299662a6f3bfec3f6fe205).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65445/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896816
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    +      callerContext.getMethod("setCurrent", callerContext).invoke(null, ret)
    +      succeed = true
    +    } catch {
    +      case NonFatal(e) => logDebug(s"$e", e)
    --- End diff --
    
    I have updated this to "case NonFatal(e) => logInfo("Fail to set Spark caller context", e)"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79844130
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,29 +2420,54 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +/**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPLICATION_MASTER)
    + *
    + * The parameters below are optional:
    + * @param appID id of the app this task belongs to
    + * @param appAttemptID attempt id of the app this task belongs to
    + * @param jobID id of the job this task belongs to
    + * @param stageID id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    + */
     private[spark] class CallerContext(
    -   appName: Option[String] = None,
    -   appID: Option[String] = None,
    -   appAttemptID: Option[String] = None,
    -   jobID: Option[Int] = None,
    -   stageID: Option[Int] = None,
    +   from: String,
    +   appId: Option[String] = None,
    +   appAttemptId: Option[String] = None,
    +   jobId: Option[Int] = None,
    +   stageId: Option[Int] = None,
        stageAttemptId: Option[Int] = None,
        taskId: Option[Long] = None,
        taskAttemptNumber: Option[Int] = None) extends Logging {
     
    -   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    -   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    -   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    -   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    -   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    -   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val AppId = if (appId.isDefined) s"_AppId_${appId.get}" else ""
    --- End diff --
    
    as mentioned please remove AppId_... the application id is pretty obvious in the logs it starts with application_ so no need to print extra characters


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Retest this please.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80161383
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    Hi, @tgravescs I want to conform this with you if I can just change and fix up everywhere that calls /extends Task. I can do this, but may change many test classes/cases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Should we also commit this PR to Branch-2? Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79692475
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    +   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    +   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    +   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    +   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    +   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val TaskId = if (taskId.isDefined) s"_TaskId_${taskId.get}" else ""
    +   val TaskAttemptNumber = if (taskAttemptNumber.isDefined) s"_${taskAttemptNumber.get}" else ""
    +
    +   val context = "SPARK" + AppName + AppID + AppAttemptID +
    +     JobID + StageID + StageAttemptId + TaskId + TaskAttemptNumber
    +
    +  def set(): Boolean = {
    +    var succeed = false
    +    try {
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    Yes. I have updated the PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @cnauroth Thank you very much for the review and suggestion. I have removed the spaces in the value of the caller context, and prepended "Spark" instead (refer to the commit [3b9a17e](https://github.com/apache/spark/pull/14659/commits/3b9a17e6dc9ef60a4c40f8aab2d0409c32b864e1)). 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79415724
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    --- End diff --
    
    for the appName and the AppId, it feels like these should be obvious from the string so I'm not sure if we really need the extra _AppName_ and _AppID_ tags there.  Are there cases you don't think that is true?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79693044
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ResultTask.scala ---
    @@ -42,7 +42,10 @@ import org.apache.spark.rdd.RDD
      *                 input RDD's partitions).
      * @param localProperties copy of thread-local properties set by the user on the driver side.
      * @param metrics a [[TaskMetrics]] that is created at driver side and sent to executor side.
    - */
    + * @param jobId id of the job this task belongs to
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    I'll try to look at this later today or tomorrow.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65422/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @tgravescs @srowen Sorry for the failure. I am looking into it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79692046
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    Making these params all optional is not to break current code which uses this API. An alternative way is to mark the current API as deprecated and add a new overloaded function with new parameters. I am going to go this way. Any suggestions?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @steveloughran Thank you very much. I have updated the PR based on your comments. Also, I have added an unit test. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78758857
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    update params and descriptions


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by cnauroth <gi...@git.apache.org>.
Github user cnauroth commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hello @Sherry302 .  Thank you for the patch.
    
    From the HDFS perspective, we recommend against using spaces in the value of the caller context.  The HDFS audit log frequently gets parsed by administrators using ad-hoc scripting.  Spaces in the fields can make this more challenging for them.  For example, if they used an awk script that parsed $NF expecting to find the callerContext, then the "on Spark" at the end would cause it to return "Spark" instead of the full caller context.
    
    May I suggest prepending "Spark" instead?  Perhaps something like this:
    
    callerContext=Spark_JobId_0_StageID_0_stageAttemptId_0_taskID_0_attemptNumber_0


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Thanks a lot for adding me as \u201ccontributor\u201d in Hadoop :) @steveloughran @cnauroth


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    thanks @Sherry302 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @tgravescs Thanks a lot for the comments. I have updated the PR to rename local vals and remove the `@since` in `Utils.scala`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/65934/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896692
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ShuffleMapTask.scala ---
    @@ -51,8 +51,12 @@ private[spark] class ShuffleMapTask(
         partition: Partition,
         @transient private var locs: Seq[TaskLocation],
         metrics: TaskMetrics,
    -    localProperties: Properties)
    -  extends Task[MapStatus](stageId, stageAttemptId, partition.index, metrics, localProperties)
    +    localProperties: Properties,
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80323261
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    OK. Thanks, @tgravescs .


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896863
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -184,6 +184,9 @@ private[spark] class ApplicationMaster(
         try {
           val appAttemptId = client.getAttemptId()
     
    +      var context = s"Spark_AppName_${System.getProperty("spark.app.name")}" +
    --- End diff --
    
    A CallerContext class has been added.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @srowen Thanks all the same.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64757 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64757/consoleFull)** for PR 14659 at commit [`ae42093`](https://github.com/apache/spark/commit/ae42093e59e37d0a4fda4280f2bbffec18c594d3).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/64372/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #63910 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/63910/consoleFull)** for PR 14659 at commit [`ec6833d`](https://github.com/apache/spark/commit/ec6833d32ef14950b2d81790bc908992f6288815).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    this is a new feature so generally don't put them into point releases which are bug fixes.
    
    @srowen  thanks for pointing out, I will take alook.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @steveloughran Thanks a lot for the comments.
    
    In the audit log, if users set some configuration in spark-defaults.conf like `spark.eventLog.dir hdfs://localhost:9000/spark-history`, there will be a record below in audit log:
    ```
    2016-08-21 23:47:50,834 INFO FSNamesystem.audit: allowed=true        ugi=wyang (auth:SIMPLE)        ip=/127.0.0.1        cmd=setPermission      src=/spark-history/application_1471835208589_0013.lz4.inprogress     dst=null        perm=wyang:supergroup:rwxrwx---       proto=rpc
    ```
    We can see the application id `application_1471835208589_0013` above. Except that case, there is no Spark application information like application name and application id (or in yarn appID+attemptID) in the audit log. So I think it is better to include application name/id in the caller context. I have updated the PR to include those information.
    
    In the commit 	[5ab2a41](https://github.com/apache/spark/pull/14659/commits/5ab2a41b93bfd73baf3798ba66fc7554b10b78e6), application ID and attemptID (only in yarn cluster mode) are included in the value of the caller context when Yarn `client` (if applications run in Yarn client mode) or `ApplicationMaster` (if applications run in Yarn cluster mode) do some operations in HDFS. So in the audit log, you can see `callercontext = Spark_appName_**_appId_**_attemptID_**`:
    _Applications in yarn cluster mode_
    ```
    2016-08-21 22:55:44,568 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=getfileinfo	src=/lr_big.txt/_spark_metadata	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_org.apache.spark.examples.SparkKMeans_AppId_application_1471835208589_0010_AttemptId_1
    2016-08-21 22:55:44,573 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=getfileinfo	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_org.apache.spark.examples.SparkKMeans_AppId_application_1471835208589_0010_AttemptId_1
    2016-08-21 22:55:44,583 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=listStatus	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_org.apache.spark.examples.SparkKMeans_AppId_application_1471835208589_0010_AttemptId_1
    2016-08-21 22:55:44,589 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_org.apache.spark.examples.SparkKMeans_AppId_application_1471835208589_0010_AttemptId_1
    2016-08-21 22:55:46,163 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=mkdirs	src=/private/tmp/hadoop-wyang/nm-local-dir/usercache/wyang/appcache/application_1471835208589_0010/container_1471835208589_0010_01_000001/spark-warehouse	dst=null	perm=wyang:supergroup:rwxr-xr-x	proto=rpc	callerContext=Spark_AppName_org.apache.spark.examples.SparkKMeans_AppId_application_1471835208589_0010_AttemptId_1
    ```
    _Applications in yarn client mode_
    ```
    2016-08-21 22:59:20,775 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=getfileinfo	src=/lr_big.txt/_spark_metadata	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_SparkKMeans_AppId_application_1471835208589_0011
    2016-08-21 22:59:20,778 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=getfileinfo	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_SparkKMeans_AppId_application_1471835208589_0011
    2016-08-21 22:59:20,785 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=listStatus	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_SparkKMeans_AppId_application_1471835208589_0011
    2016-08-21 22:59:20,791 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppName_SparkKMeans_AppId_application_1471835208589_0011
    ```
     In the commit [1512775,](https://github.com/apache/spark/pull/14659/commits/1512775a3faddb9de9299662a6f3bfec3f6fe205) application ID, name and attempt ID (only in yarn cluster mode) are included in the value of the caller context when `Tasks` do operations in HDFS. So in the audit log, you can see `callercontext=Spark_appName_**_appID_**_appAttemtID_**_JobId_**_StageID_**_stageAttemptId_**_taskID_**_attemptNumber_**`:
    _Applications in Yarn cluster mode_
    ```
    2016-08-21 22:55:50,977 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0010_AppAttemptId_1_JobId_0_StageID_0_stageAttemptId_0_taskID_3_attemptNumber_0
    2016-08-21 22:55:50,978 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0010_AppAttemptId_1_JobId_0_StageID_0_stageAttemptId_0_taskID_5_attemptNumber_0
    2016-08-21 22:55:50,978 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0010_AppAttemptId_1_JobId_0_StageID_0_stageAttemptId_0_taskID_1_attemptNumber_0
    ```
    _Applications in Yarn client mode_
    ```
    2016-08-21 23:15:43,089 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0012_AppAttemptId_None_JobId_0_StageID_0_stageAttemptId_0_taskID_3_attemptNumber_0
    2016-08-21 23:15:43,089 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0012_AppAttemptId_None_JobId_0_StageID_0_stageAttemptId_0_taskID_5_attemptNumber_0
    2016-08-21 23:15:43,089 INFO FSNamesystem.audit: allowed=true	ugi=wyang (auth:SIMPLE)	ip=/127.0.0.1	cmd=open	src=/lr_big.txt	dst=null	perm=null	proto=rpc	callerContext=Spark_AppId_application_1471835208589_0012_AppAttemptId_None_JobId_0_StageID_0_stageAttemptId_0_taskID_1_attemptNumber_0
    ```
    For commit [1512775,](https://github.com/apache/spark/pull/14659/commits/1512775a3faddb9de9299662a6f3bfec3f6fe205) , Application Id and attemptID are passed to \u2018Task\u2019, is it good for \u2018Task\u2019 to see those application information? What do you think about this @steveloughran ? Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Chris: maybe the CallerContext class could check for bad characters, including spaces, newlines, "," and quotation marks .. the usual things to break parsers.
    
    There's also application ID, (or in yarn appID+attemptID); does that need to be included \u2014or does the audit log include enough about the application that it's not needed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79457356
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -196,8 +198,13 @@ private[spark] class ApplicationMaster(
             // Set this internal configuration if it is running on cluster mode, this
             // configuration will be checked in SparkContext to avoid misuse of yarn cluster mode.
             System.setProperty("spark.yarn.app.id", appAttemptId.getApplicationId().toString())
    +
    +        attemptID = Option(appAttemptId.getAttemptId.toString)
           }
     
    +      new CallerContext(Option(System.getProperty("spark.app.name")),
    --- End diff --
    
    would it be useful to add something special here to differentiate the tasks from master vs client.  just like a static string "master" and for client "client"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Thanks @tgravescs yes. I have created a PR [15286](https://github.com/apache/spark/pull/15286). 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r76951863
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,18 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Unit = {
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    +      callerContext.getMethod("setCurrent", callerContext).invoke(null, ret)
    +    } catch {
    +      case NonFatal(e) => logDebug(s"${e.getMessage}")
    --- End diff --
    
    1. better to use  `logDebug(s"$e", e)`. Some exceptions (e.g. `NullPointerException`) return null from `getMessage()`; you may also want the stack


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r76952473
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,18 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Unit = {
    --- End diff --
    
    If this is set to return a Boolean on success, you could have a unit test which asserts that when called on a version of Hadoop with the resource `/org/apache/hadoop/ipcCallerContext.class`, that it returned true. That way you could assert that "on a version of Hadoop with a caller context, this code sets it". That will help catch any regressions in the Hadoop code breaking this reflection stuff.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896681
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ResultTask.scala ---
    @@ -51,8 +51,12 @@ private[spark] class ResultTask[T, U](
         locs: Seq[TaskLocation],
         val outputId: Int,
         localProperties: Properties,
    -    metrics: TaskMetrics)
    -  extends Task[U](stageId, stageAttemptId, partition.index, metrics, localProperties)
    +    metrics: TaskMetrics,
    +    jobId: Option[Int] = None,
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64380 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64380/consoleFull)** for PR 14659 at commit [`1512775`](https://github.com/apache/spark/commit/1512775a3faddb9de9299662a6f3bfec3f6fe205).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    That Caller context doesn't list Spark as one of the users in its LimitedPrivate scope. Add a Hadoop patch there and I'll get it in. This avoids arguments later when someone breaks the API, and is especially important when using reflection, as it's harder to detect when the Class is being used.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79693000
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    +   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    +   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    +   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    +   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    +   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val TaskId = if (taskId.isDefined) s"_TaskId_${taskId.get}" else ""
    +   val TaskAttemptNumber = if (taskAttemptNumber.isDefined) s"_${taskAttemptNumber.get}" else ""
    +
    +   val context = "SPARK" + AppName + AppID + AppAttemptID +
    +     JobID + StageID + StageAttemptId + TaskId + TaskAttemptNumber
    +
    +  def set(): Boolean = {
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64372 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64372/consoleFull)** for PR 14659 at commit [`1512775`](https://github.com/apache/spark/commit/1512775a3faddb9de9299662a6f3bfec3f6fe205).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79843188
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    so Task is a private spark api so there is no issues breaking api.  You don't need to deprecate and add new, you can just change and fix up everywhere that calls it or extends it.
    There are a handful of test classes that extend it that would need to be fixed up.  Let me think about it a bit more.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65427 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65427/consoleFull)** for PR 14659 at commit [`748e7a9`](https://github.com/apache/spark/commit/748e7a9b6f6fe928df9e49f8e020d02126123be8).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65445 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65445/consoleFull)** for PR 14659 at commit [`748e7a9`](https://github.com/apache/spark/commit/748e7a9b6f6fe928df9e49f8e020d02126123be8).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78896972
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    --- End diff --
    
    Yes. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79849949
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,29 +2420,54 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +/**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPLICATION_MASTER)
    + *
    + * The parameters below are optional:
    + * @param appID id of the app this task belongs to
    + * @param appAttemptID attempt id of the app this task belongs to
    + * @param jobID id of the job this task belongs to
    + * @param stageID id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    + */
     private[spark] class CallerContext(
    -   appName: Option[String] = None,
    -   appID: Option[String] = None,
    -   appAttemptID: Option[String] = None,
    -   jobID: Option[Int] = None,
    -   stageID: Option[Int] = None,
    +   from: String,
    +   appId: Option[String] = None,
    +   appAttemptId: Option[String] = None,
    +   jobId: Option[Int] = None,
    +   stageId: Option[Int] = None,
        stageAttemptId: Option[Int] = None,
        taskId: Option[Long] = None,
        taskAttemptNumber: Option[Int] = None) extends Logging {
     
    -   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    -   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    -   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    -   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    -   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    -   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val AppId = if (appId.isDefined) s"_AppId_${appId.get}" else ""
    +   val AppAttemptId = if (appAttemptId.isDefined) s"_AttemptId_${appAttemptId.get}" else ""
    --- End diff --
    
    I don't agree with adding the AttemptId_ string back.  I understand it helps readability but its a lot of characters compared to the actual attempt id.   I want this thing to be as small as possible as to not add extra overhead to the rpc calls.   The strings from your example run are already 112 characters long (SPARK_TASK_AppId_application_1474394339641_0006_AttemptId_1_JobId_0_StageId_0_AttemptId_0_TaskId_14_AttemptNum_0), if you start getting into many tasks and stages that could reach the default 128 print to the audit log and get truncated.      
    
    how about SPARK_TASK_application_1474394339641_0006_1_JId_0_SId_0_0_TId_14_0, that is only 66 characters.  yes the user may have to look up the format but I think that is ok.  If its really that big of an issue parsing this we can change it later but I would rather have it smaller and better performance and and have all the information (rather then it possibly getting truncated). 
    
     Really right now I think all you need is the task id and attempt because the numbers just increase across jobs and stages, but having the job id and stage id would be helpful to find the task id quickly and handles if that every changes and we have taskid unique per job or stage.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/64757/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    its there to make sure everyone is using the same classloader and to handle if it they are chained. I'm not really familiar with all the scenarios of the repl.  I see the Suite itself is getting the classloader and loading somethings based on uri.   
    
    I think for now can you put up a patch changing to use Class.forName and we can file a followup jira to investigate more.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80482936
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2421,6 +2421,69 @@ private[spark] object Utils extends Logging {
     }
     
     /**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPMASTER)
    + *
    + * The parameters below are optional:
    + * @param appId id of the app this task belongs to
    + * @param appAttemptId attempt id of the app this task belongs to
    + * @param jobId id of the job this task belongs to
    + * @param stageId id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    + */
    +private[spark] class CallerContext(
    +   from: String,
    +   appId: Option[String] = None,
    +   appAttemptId: Option[String] = None,
    +   jobId: Option[Int] = None,
    +   stageId: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppId = if (appId.isDefined) s"_${appId.get}" else ""
    --- End diff --
    
    make all these local vals start with lower case, add Str to them if you need to differentiate  appIdStr


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78897068
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    +        s"_JobId_${jobId.getOrElse("0")}_StageID_${stageId}_stageAttemptId_${stageAttemptId}" +
    +        s"_taskID_${taskAttemptId}_attemptNumber_${attemptNumber}"
    +    Utils.setCallerContext(callerContext)
    --- End diff --
    
    Yes. Good catch!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79692960
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -196,8 +198,13 @@ private[spark] class ApplicationMaster(
             // Set this internal configuration if it is running on cluster mode, this
             // configuration will be checked in SparkContext to avoid misuse of yarn cluster mode.
             System.setProperty("spark.yarn.app.id", appAttemptId.getApplicationId().toString())
    +
    +        attemptID = Option(appAttemptId.getAttemptId.toString)
           }
     
    +      new CallerContext(Option(System.getProperty("spark.app.name")),
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79457084
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    --- End diff --
    
    thinking about this a little more I think we should just remove app name altogether. For tracking purposes the app id should be enough. The app name adds in a bunch of unknowns (length or it, weird characters or just spaces) which could cause things in the audit log to be less useful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65422 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65422/consoleFull)** for PR 14659 at commit [`4fc8c79`](https://github.com/apache/spark/commit/4fc8c799894fe265f96250e567377c1bf2702617).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @tgravescs @srowen Thanks. Using `Class.forName` which uses `this.getClass().getClassLoader()` by default makes all the tests passed (both sbt and maven). However there must be some reason we prefer `Utils.classForName` instead. Do you have any suggestions?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79847913
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -202,8 +202,8 @@ private[spark] class ApplicationMaster(
             attemptID = Option(appAttemptId.getAttemptId.toString)
           }
     
    -      new CallerContext(Option(System.getProperty("spark.app.name")),
    -        Option(appAttemptId.getApplicationId.toString), attemptID).set()
    +      new CallerContext("APPLICATION_MASTER",
    --- End diff --
    
    truncate to APPMASTER


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by steveloughran <gi...@git.apache.org>.
Github user steveloughran commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    This context is just something passed over IPC to provide a general string for the audit logs, the main actual access of it is in the HDFS audit log
    ```
            HdfsAuditLogger hdfsLogger = (HdfsAuditLogger) logger;
            hdfsLogger.logAuditEvent(succeeded, ugiStr, addr, cmd, src, dst,
                status, CallerContext.getCurrent(), ugi, dtSecretManager);
    ```
    Otherwise it gets passed along RPC calls (along with htrace context), and set by the various entry points (CLI, MR, etc). Lets you find out which piece of code is bringing your NN to its knees. See [HDFS-9184](https://issues.apache.org/jira/browse/HDFS-9184)
    
    I'd nominate @cnauroth as someone capable of reviewing the link up with HDFS; he's happy now that there aren't spaces in the context string.
    
    Spark-wise: I've added a comment on how a test for this could be written. The HBase keytab reflection code showed me how brittle some of that stuff can be to changes in the reflected-on classes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78898595
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    --- End diff --
    
    Yes. hdfsContext is more readable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Hi, @srowen Could you please review this PR? Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78768851
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -184,6 +184,9 @@ private[spark] class ApplicationMaster(
         try {
           val appAttemptId = client.getAttemptId()
     
    +      var context = s"Spark_AppName_${System.getProperty("spark.app.name")}" +
    --- End diff --
    
    it would be nice to have a class or at least util function to construct the context string so that we don't have same string in multiple places.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65799 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65799/consoleFull)** for PR 14659 at commit [`47de8a2`](https://github.com/apache/spark/commit/47de8a2a9e1640e0ea942d1a689150d7b7a66c10).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #64757 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/64757/consoleFull)** for PR 14659 at commit [`ae42093`](https://github.com/apache/spark/commit/ae42093e59e37d0a4fda4280f2bbffec18c594d3).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80579059
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2421,6 +2421,69 @@ private[spark] object Utils extends Logging {
     }
     
     /**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPMASTER)
    + *
    + * The parameters below are optional:
    + * @param appId id of the app this task belongs to
    + * @param appAttemptId attempt id of the app this task belongs to
    + * @param jobId id of the job this task belongs to
    + * @param stageId id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    + */
    +private[spark] class CallerContext(
    +   from: String,
    +   appId: Option[String] = None,
    +   appAttemptId: Option[String] = None,
    +   jobId: Option[Int] = None,
    +   stageId: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppId = if (appId.isDefined) s"_${appId.get}" else ""
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79695449
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    --- End diff --
    
    I have updated the PR to remove appName, and replace appName with something to differentiate the context from ApplicationMaster vs Yarn Client vs Task. But for AppID, I think it is better to keep it since in hdfs-audit.log, there is no info about application. For example, the record below was produced when Task did a read/write operation to HDFS, except `callerContext`, there is no other info about application:
    ```
    2016-09-14 22:29:06,526 INFO FSNamesystem.audit: allowed=true   ugi=wyang (auth:SIMPLE) ip=/127.0.0.1   cmd=open    src=/lr_big.txt dst=null    perm=null   proto=rpc   callerContext=SPARK_AppID_application_1473908768790_0007_JobID_0_StageID_0_0_TaskId_2_0
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/63910/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    @tgravescs Sure. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by Sherry302 <gi...@git.apache.org>.
Github user Sherry302 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r80579032
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2421,6 +2421,69 @@ private[spark] object Utils extends Logging {
     }
     
     /**
    + * An utility class used to set up Spark caller contexts to HDFS and Yarn. The `context` will be
    + * constructed by parameters passed in.
    + * When Spark applications run on Yarn and HDFS, its caller contexts will be written into Yarn RM
    + * audit log and hdfs-audit.log. That can help users to better diagnose and understand how
    + * specific applications impacting parts of the Hadoop system and potential problems they may be
    + * creating (e.g. overloading NN). As HDFS mentioned in HDFS-9184, for a given HDFS operation, it's
    + * very helpful to track which upper level job issues it.
    + *
    + * @param from who sets up the caller context (TASK, CLIENT, APPMASTER)
    + *
    + * The parameters below are optional:
    + * @param appId id of the app this task belongs to
    + * @param appAttemptId attempt id of the app this task belongs to
    + * @param jobId id of the job this task belongs to
    + * @param stageId id of the stage this task belongs to
    + * @param stageAttemptId attempt id of the stage this task belongs to
    + * @param taskId task id
    + * @param taskAttemptNumber task attempt id
    + * @since 2.0.1
    --- End diff --
    
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r78769775
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -79,6 +82,13 @@ private[spark] abstract class Task[T](
           metrics)
         TaskContext.setTaskContext(context)
         taskThread = Thread.currentThread()
    +
    +    val callerContext =
    +      s"Spark_AppId_${appId.getOrElse("")}_AppAttemptId_${appAttemptId.getOrElse("None")}" +
    +        s"_JobId_${jobId.getOrElse("0")}_StageID_${stageId}_stageAttemptId_${stageAttemptId}" +
    +        s"_taskID_${taskAttemptId}_attemptNumber_${attemptNumber}"
    +    Utils.setCallerContext(callerContext)
    --- End diff --
    
    we should move this below the if(_killed) check as not reason to log this if it doesn't run.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79419642
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
    @@ -54,7 +54,10 @@ private[spark] abstract class Task[T](
         val partitionId: Int,
         // The default value is only used in tests.
         val metrics: TaskMetrics = TaskMetrics.registered,
    -    @transient var localProperties: Properties = new Properties) extends Serializable {
    +    @transient var localProperties: Properties = new Properties,
    +    val jobId: Option[Int] = None,
    --- End diff --
    
    are these params all optional just to make it easier for different task types?  the jobId and appId I think are mandatory now, the appattempt id is still really optional.  I'm leaning towards making this not be Option so that is someone adds a new Task Type we make sure these are setup properly and thus context set properly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79419042
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/ResultTask.scala ---
    @@ -42,7 +42,10 @@ import org.apache.spark.rdd.RDD
      *                 input RDD's partitions).
      * @param localProperties copy of thread-local properties set by the user on the driver side.
      * @param metrics a [[TaskMetrics]] that is created at driver side and sent to executor side.
    - */
    + * @param jobId id of the job this task belongs to
    --- End diff --
    
    description should mention these are optional.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    Yeah its definitely caused by the call in Task to the Utils.CallerContext.setCurrent().  It seems to be from it using the ExecutorClassLoader to go try to check the class for the executor and I guess because ExecutorClassLoader overrides findClass which is called form loadClass which is called from forName.  There must be something slightly different in the MessageMatcher which I guess is generated on the fly by netty.  I guess loading the remote one must mismatch with the local one.
    
    @srowen  do you think we revert this while we figure it out? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79408637
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    +   val AppID = if (appID.isDefined) s"_AppID_${appID.get}" else ""
    +   val AppAttemptID = if (appAttemptID.isDefined) s"_${appAttemptID.get}" else ""
    +   val JobID = if (jobID.isDefined) s"_JobID_${jobID.get}" else ""
    +   val StageID = if (stageID.isDefined) s"_StageID_${stageID.get}" else ""
    +   val StageAttemptId = if (stageAttemptId.isDefined) s"_${stageAttemptId.get}" else ""
    +   val TaskId = if (taskId.isDefined) s"_TaskId_${taskId.get}" else ""
    +   val TaskAttemptNumber = if (taskAttemptNumber.isDefined) s"_${taskAttemptNumber.get}" else ""
    +
    +   val context = "SPARK" + AppName + AppID + AppAttemptID +
    +     JobID + StageID + StageAttemptId + TaskId + TaskAttemptNumber
    +
    +  def set(): Boolean = {
    +    var succeed = false
    +    try {
    +      val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    Actually perhaps add a description to this entire class that explain what this is, what it applies to and when it was added.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #14659: [SPARK-16757] Set up Spark caller context to HDFS...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14659#discussion_r79841783
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2420,6 +2420,44 @@ private[spark] object Utils extends Logging {
       }
     }
     
    +private[spark] class CallerContext(
    +   appName: Option[String] = None,
    +   appID: Option[String] = None,
    +   appAttemptID: Option[String] = None,
    +   jobID: Option[Int] = None,
    +   stageID: Option[Int] = None,
    +   stageAttemptId: Option[Int] = None,
    +   taskId: Option[Long] = None,
    +   taskAttemptNumber: Option[Int] = None) extends Logging {
    +
    +   val AppName = if (appName.isDefined) s"_AppName_${appName.get}" else ""
    --- End diff --
    
    I'm not sure what you mean here there is no information about the application.  its pretty clear that the application id in your example is: application_1473908768790_0007.  We don't need the extra 6 characters AppID_ to tell us that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #14659: [SPARK-16757] Set up Spark caller context to HDFS and YA...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/14659
  
    **[Test build #65799 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65799/consoleFull)** for PR 14659 at commit [`47de8a2`](https://github.com/apache/spark/commit/47de8a2a9e1640e0ea942d1a689150d7b7a66c10).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org