From 73decdd15e569456fc18a811f2909dff019b4e67 Mon Sep 17 00:00:00 2001 From: JAMES LETTS Date: Fri, 27 Mar 2015 17:00:35 -0700 Subject: [PATCH] More bugs removed. --- multi-core-standalone.sh | 40 +++++++++++++++++++++++++++++----------- multi-core.py | 8 ++++---- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/multi-core-standalone.sh b/multi-core-standalone.sh index 02ec0d1..1768ea1 100755 --- a/multi-core-standalone.sh +++ b/multi-core-standalone.sh @@ -20,6 +20,7 @@ GetCondorInfo() { condor_status -pool $glideinWMS_COLLECTOR \ -format '%s,' GLIDEIN_CMSSite \ -format '%s,' SlotType \ + -format '%s,' Name \ -format '%s,' GLIDEIN_ToRetire \ -format '%s,' CPUs \ -format '%s,' State \ @@ -29,6 +30,7 @@ GetCondorInfo() { } NOW=`GetCondorInfo` +#NOW=`/bin/date +%s` #ALSONOW=`echo $NOW | awk '{print strftime("%F %R",$1)}'` #echo $TMPFILE has `cat $TMPFILE | wc -l` lines created at $ALSONOW. @@ -38,14 +40,24 @@ NOW=`GetCondorInfo` ExtractCondorInfo() { SITE=$1 SLOTTYPE=$2 - SEARCHSTRING=`echo $SITE,$SLOTTYPE | sed 's/All//' | sed 's/Total//'` + SEARCHSTRING1=`echo $SITE,$SLOTTYPE | sed 's/All//' | sed 's/Total//'` - # check if retiring, then do the query of the condor information - RETIRING=$3 - if [ -z $RETIRING ] ; then - grep $SEARCHSTRING $TMPFILE | awk -F\, '{print $4 " " $5 " " $6}' + # should we explicity check for multi-core? + SEARCHSTRING2=$SEARCHSTRING1 + echo $@ | grep "multi-core" >> /dev/null + if [ $? -eq 0 ] ; then + SEARCHSTRING2=",slot" + fi + + # should we explicity check the retiring time? + # then get the glidein information + echo $@ | grep "retiring" >> /dev/null + if [ $? -eq 0 ] ; then + grep $SEARCHSTRING1 $TMPFILE | grep $SEARCHSTRING2 | \ + awk -F\, -v NOW=$NOW '($30; i--) { print $2 " " $3 } }' | sort | uniq -c | \ awk '{printf(" [\"%s\",\"%s\",%i],\n",$2,$3,$1)}' | \ @@ -63,7 +75,7 @@ ExtractCondorInfo() { WriteOutTable() { SITE=$1 TITLE=$2 - echo " \"$TITLE\": {" + echo " \"$TITLE glidein Cpus\": {" echo " \"header\": [\"State\",\"Activity\",\"Cpus\"]," echo " \"data\": [" ExtractCondorInfo $SITE $TITLE @@ -90,13 +102,17 @@ WriteOutJsonFile() { # Write out the individual tables for the different types of glideins WriteOutTable $SITE "Partitionable" - WriteOutTable $SITE "Partitionable Retiring" + WriteOutTable $SITE "Partitionable retiring" WriteOutTable $SITE "Dynamic" - WriteOutTable $SITE "Dynamic Retiring" + WriteOutTable $SITE "Dynamic retiring" WriteOutTable $SITE "Static" - WriteOutTable $SITE "Static Retiring" + WriteOutTable $SITE "Static retiring" + WriteOutTable $SITE "Static multi-core" + WriteOutTable $SITE "Static multi-core retiring" + WriteOutTable $SITE "Total multi-core" + WriteOutTable $SITE "Total multi-core retiring" WriteOutTable $SITE "Total" - WriteOutTable $SITE "Total Retiring" | sed -e "\$s/,//" + WriteOutTable $SITE "Total retiring" | sed -e "\$s/,//" # close the json file echo " }" @@ -105,9 +121,11 @@ WriteOutJsonFile() { } +WriteOutJsonFile "All" WriteOutJsonFile "T1_ES_PIC" WriteOutJsonFile "T1_US_FNAL" WriteOutJsonFile "T2_US_Purdue" +WriteOutJsonFile "T2_US_UCSD" # Clean up rm $TMPFILE diff --git a/multi-core.py b/multi-core.py index 80e56d2..c7dbdc9 100755 --- a/multi-core.py +++ b/multi-core.py @@ -24,7 +24,7 @@ print "Dynamic+Partitionable Idle %,", print "Dynamic+Partitionable Retiring Idle%" -FILES=glob.glob("/crabprod/CSstoragePath/Monitor-json/monitor-multicore-*.json") +FILES=glob.glob("/crabprod/CSstoragePath/Monitor/json/monitor-T1_ES_PIC-*.json") for FILE in FILES : try : @@ -55,7 +55,7 @@ totals[TABLE]=float(total) wasted[TABLE]=float(total-busy) - total_totals=float(totals['Total Cpus']) + total_totals=float(totals['Total glidein Cpus']) static_totals=float(totals['Static multi-core glidein Cpus']) static_retiring_totals=float(totals['Static multi-core retiring glidein Cpus']) partitionable_totals=float(totals['Dynamic glidein Cpus']+totals['Partitionable glidein Cpus']) @@ -67,7 +67,7 @@ print '{0:6.0f},'.format(partitionable_totals), print '{0:6.0f},'.format(partitionable_retiring_totals), - total_wasted=float(wasted['Total Cpus']) + total_wasted=float(wasted['Total glidein Cpus']) static_wasted=float(wasted['Static multi-core glidein Cpus']) static_retiring_wasted=float(wasted['Static multi-core retiring glidein Cpus']) partitionable_wasted=float(wasted['Dynamic glidein Cpus']+wasted['Partitionable glidein Cpus']) @@ -80,7 +80,7 @@ print '{0:6.0f},'.format(partitionable_retiring_wasted), try : - total_wasted/=totals['Total Cpus'] + total_wasted/=totals['Total glidein Cpus'] except ZeroDivisionError : total_wasted=0.