#首先看一下提交脚本
#/sbin/bash
/opt/cloudera/parcels/SPARK2/bin/spark2-submit \
export JAVA_HOME=/opt/jdk1.8.0_31
TASK_TYPE=$1
TASK_JSON=$2
SPARK_CONFIG=$3
appId=`
$SPARK_CONFIG \
"$TASK_JSON" \
$TASK_TYPE \
2>&1 | tee /dev/tty | grep -i "Submitting application" | grep -o application_[0-#9]*_[0-9]*`
echo "appid:"$appId
就是下面这两个 我们输出格式application_1591596770810_0207
appId=2>&1 | tee /dev/tty | grep -i "Submitting application" | grep -o application_[0-#9]*_[0-9]*
echo “appid:”$appId
###利用yarn提供的restapi去取
//yarnaddress: http://*****:8088/ws/v1/cluster/apps
private String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}