1. [SPARK-37461][YARN] YARN-CLIENT mode client.appId is always null (details)
Commit db9a982a1441810314be07e2c3b7ccffff77d1f1 by srowen
[SPARK-37461][YARN] YARN-CLIENT mode client.appId is always null

### What changes were proposed in this pull request?
In yarn-client mode, `Client.appId` variable is not assigned, it is always `null`,  in cluster mode, this variable will be assigned to the true value. In this patch, we assign true application id to `appId` too

### Why are the changes needed?

1. Refactor the code to avoid define different id in each function, we can just use this variable.
2. In client mode, user can use this value to get the application id.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?
Manuel tested.

We have a internal proxy server to replace yarn tracking url, here use `appId`, with this patch it's not null.

21/11/26 12:38:44 INFO Client:
client token: N/A
diagnostics: AM container is launched, waiting for AM container to Register with RM
ApplicationMaster host: N/A
ApplicationMaster RPC port: -1
queue: user_queue
start time: 1637901520956
final status: UNDEFINED
tracking URL: http://internal-proxy-server/proxy?applicationId=application_1635856758535_4209064
user: user_name

Closes #34710 from AngersZhuuuu/SPARK-37461.

Authored-by: Angerszhuuuu <>
Signed-off-by: Sean Owen <>
The file was modifiedresource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala (diff)