问题
Is there an easy way to query the yarn applications api to get applications which have run for more than x amount of time?
Following url gives a list of apps, but doesn't look like it respects the elapsedTime parameter
http://<RM_DOMAIN>:<RM_PORT>/ws/v1/cluster/apps?states=RUNNING&elapsedTime=200000
回答1:
elapsedTime is not a supported Query Parameter.
You can use jq to filter the apps that match the criteria.
curl http://<RM_DOMAIN>:<RM_PORT>/ws/v1/cluster/apps?states=RUNNING | jq '.apps.app[]| select(.elapsedTime > 200000)'
Or you can use startedTimeBegin parameter, to get all the apps with start time beginning with this time (ms since epoch). For example,
curl http://<RM_DOMAIN>:<RM_PORT>/ws/v1/cluster/apps?states=RUNNING&startedTimeBegin=1492968581437
来源:https://stackoverflow.com/questions/43552215/yarn-api-get-applications-by-elapsedtime