Skip to content

Commit

Permalink
Updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesletts committed May 2, 2014
1 parent 0b601ba commit 727ca23
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
10 changes: 5 additions & 5 deletions condor_functions.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/bash

# BUG: -const '(CurrentTime-EnteredCurrentStatus<86400)' is being ignored!
# Worse, its being taken as the opposite ... ????

getClassAds() {
# Function to dump a set of ClassAds for queued, running and jobs
# from the past 24h of condor history. If the command fails remotely,
# then one can try to gsissh to the node to execute the query.
#
# Usage:
# getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_history -const '(CurrentTime-EnteredCurrentStatus<86400)'"
# getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_history"
# getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_q"
# Output:
# Space separated list of job ClassAds, one row per job.
Expand All @@ -19,10 +20,10 @@ getClassAds() {
SCHEDDNAME=$1 ; shift
MACHINENAME=$1 ; shift

# It is convenient to have JobStatus first to distinguish
# it from LastJobStatus.
NOW=`/bin/date +%s`
YESTERDAY=$[$NOW-86400]
command="$@ \
-const '(CurrentTime-EnteredCurrentStatus<86400)' \
-const '(EnteredCurrentStatus>$YESTERDAY)' \
-format 'JobStatus=%i\ ' JobStatus \
-format 'LastJobStatus=%i\ ' LastJobStatus \
-format 'ExitCode=%i\ ' ExitCode \
Expand Down Expand Up @@ -109,7 +110,6 @@ condor_history_dump() {
for SCHEDD in $SCHEDDS ; do
SCHEDDNAME=` echo $SCHEDD | awk -F\, '{print $1}'`
MACHINENAME=`echo $SCHEDD | awk -F\, '{print $2}'`
#getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_history -const '(CurrentTime-EnteredCurrentStatus<86400)'"
getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_history"
getClassAds $POOLNAME $SCHEDDNAME $MACHINENAME "condor_q"
done
Expand Down
14 changes: 7 additions & 7 deletions condor_history_analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ END {
}
' | grep ^T | sort

echo
echo
echo USER PRIORITIES:
echo
condor_userprio -all -pool $POOLNAME
#condor_userprio -allusers -all -pool $POOLNAME

#doesnt work $glideinWMSMonitor_RELEASE_DIR/debug.sh

#echo
#echo
#echo USER PRIORITIES:
#echo
#condor_userprio -all -pool $POOLNAME
#condor_userprio -allusers -all -pool $POOLNAME
$glideinWMSMonitor_RELEASE_DIR/debug.sh $FILE

exit
16 changes: 12 additions & 4 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#!/bin/bash

FILE=$1

export TZ=UTC0

count_entries_in_history_file() {
STATUS=$1
TITLE=$2
echo
echo $TITLE
printf "%-35s %-35s %15s\n" "schedd Name" "Earliest Entry" "Number of Jobs"
printf "%-35s %8s %-35s\n" "schedd Name" "Jobs" "Earliest Entry Time"
#SCHEDDS=`cat $FILE | awk -F\= '{print $NF}' | awk -F\# '{print $1}' | sort | uniq | sort`
SCHEDDS=`condor_status -schedd -format '%s\n' Name`
for SCHEDD in $SCHEDDS ; do
grep ^JobStatus=$STATUS $FILE | grep $SCHEDD | grep -o 'EnteredCurrentStatus=[0-9]*' \
| awk -F\= -v now=`/bin/date +%s` -v schedd=$SCHEDD \
'BEGIN{x=now;n=0}{if($2<x){x=$2};n+=1}END{printf("%-35s %-35s %15i\n",schedd,strftime("%c",x),n)}'
earliest=`grep ^JobStatus=$STATUS $FILE | grep $SCHEDD\# | grep -o 'EnteredCurrentStatus=[0-9]*' \
| sort -n -r | tail -1 | awk -F\= '{print strftime("%c",$2)}'`
n=`grep ^JobStatus=$STATUS $FILE | grep $SCHEDD\# | wc -l`
printf "%-35s %8i %-35s\n" $SCHEDD $n "$earliest"
done
}

echo
echo "====================================== BEGIN DEBUG ======================================="
echo
echo $FILE
echo
count_entries_in_history_file 4 "COMPLETED JOBS:"
count_entries_in_history_file 3 "REMOVED JOBS:"
count_entries_in_history_file 5 "HELD JOBS:"
Expand Down

0 comments on commit 727ca23

Please sign in to comment.