Passing xargs values as argument to subsequent YARN command Passing xargs values as argument to subsequent YARN command hadoop hadoop

Passing xargs values as argument to subsequent YARN command


xargs reads the STDIN stream data and converts each line into space separated arguments to the command. Some reasons why xargs might not work in your case:

  1. Using xargs, the argument to this command "yarn application-movetoqueue 'application_ID' -queue myqueue" is passed at the end of it.
  2. Not all the applications/tools accept multiple space separatedarguments.
  3. The result of your command is a string containing special characters and it should be quoted.

So, I would suggest the following:

for appid in `yarn application -list -appStates RUNNING | grep user|awk '{print $1}'` ; do     yarn application -movetoqueue "${appid}" -queue myqueue;done