#!/usr/bin/awk -f # parse output of the following condor_q command: # condor_q -glob -all -cons 'Member(Jobstatus,{1,2})' -af Owner '{"0","P","R","X","C","H",">","S"}[JobStatus]' AcctGroup RequestCpus RequestMemory # a sample output line #atlasprd011 R atlas 8 16000 BEGIN { #print header printf "%12s %8s %8s %8s %8s\n","QUEUE","SC_RUN","MC_RUN","PEND","MEM(GB)" } {if($2=="R"){ nr[$3] += $4 #running cores mcr[$3] += ($4 > 1 ? $4 : 0) #running multicores mem[$3] += $5/1000 }else{ np[$3]+=$4 #pending cores } }END{ for (k in nr){ printf "%12s %8d %8d %8d %8d\n", k, nr[k],mcr[k],np[k],mem[k] totsc += nr[k] totmc += mcr[k] totp += np[k] totmem += mem[k] } printf "%12s","----------\n" printf "%12s %8s %8s %8s %8s\n","TOTAL",totsc,totmc,totp,totmem }