Skip to content

Commit

Permalink
More bugs removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesletts committed Mar 28, 2015
1 parent a88fe51 commit 73decdd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
40 changes: 29 additions & 11 deletions multi-core-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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.

Expand All @@ -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 '($3<NOW){print $5 " " $6 " " $7}'
else
grep $SEARCHSTRING $TMPFILE | awk -F\, -v NOW=$NOW '($3<NOW){print $4 " " $5 " " $6}'
grep $SEARCHSTRING1 $TMPFILE | grep $SEARCHSTRING2 | \
awk -F\, '{print $5 " " $6 " " $7}'
fi | \
awk ' { for (i=$1; i>0; i--) { print $2 " " $3 } }' | sort | uniq -c | \
awk '{printf(" [\"%s\",\"%s\",%i],\n",$2,$3,$1)}' | \
Expand All @@ -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
Expand All @@ -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 " }"
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions multi-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down Expand Up @@ -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'])
Expand All @@ -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'])
Expand All @@ -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.

Expand Down

0 comments on commit 73decdd

Please sign in to comment.