Created 04-17-2018 11:16 AM
Do we have sort option for resource manager when we access through curl rest api?
I'm using as below, but it is not resulting in sorted order.
curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?sort=queueUsagePercentage&order_by=asc&state=running&limit=20"
Can someone help here on this.
Thanks,
Purna Chandra Mahesh.
Created 04-18-2018 07:17 AM
There is no sort or order_by query parameter supported in the ResourceManager rest api. For your curl request, you can check the documentation at http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_A...
The only option now is to sort at the client side. For command line, one easy way is to install a tool called jq https://stedolan.github.io/jq/download/ if you are interested. For your use case, you can do something like follows:
curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)'
For descending sort you can use,
curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)|reverse'
Hope this helps.
Created 04-18-2018 07:17 AM
There is no sort or order_by query parameter supported in the ResourceManager rest api. For your curl request, you can check the documentation at http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_A...
The only option now is to sort at the client side. For command line, one easy way is to install a tool called jq https://stedolan.github.io/jq/download/ if you are interested. For your use case, you can do something like follows:
curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)'
For descending sort you can use,
curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)|reverse'
Hope this helps.