cloudera / cm_api

Cloudera Manager API Client
Apache License 2.0
305 stars 284 forks source link

API: /clusters/{clusterName}/services/{serviceName}/yarnApplications #70

Open Hackeruncle opened 6 years ago

Hackeruncle commented 6 years ago

API: /clusters/{clusterName}/services/{serviceName}/yarnApplications CDH: 5.12

I want to use the cm api , check this job is still running or not running.

Steps:

  1. Spark streaming job running is 2 days.

  2. Shell: JOB_NAME=SparkStreamingJob curl -u $CDHUSER:$CDHPASSWORD $CDHURL/api/v17/clusters/JYDWCluster/services/yarn/yarnApplications > cdh.json cat cdh.json | grep -A 4 $JOB_NAME > job.log RUNNINGNUM=cat job.log | grep "state" | grep "RUNNING" | wc -l

  3. In most cases, this job is existed in the cm api result. But ,once in a while, this job is not existed in the cm api result, is strange. I suspect it's a bug.