Skip to content

Commit

Permalink
Added CRAB3 analysis pressure (i.e. where AcctGroup=analysis is used).
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesletts committed Apr 26, 2015
1 parent f4c2bff commit d6f6452
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
19 changes: 12 additions & 7 deletions condor_check
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ DOWNTIMES=`site_downtimes_from_ssb`
CLAIMED=`get_pilot_cpus_by_site $COLLECTOR1 -claimed` || exit 4
RUNNING=`get_pilot_cpus_by_site $COLLECTOR1` || exit 5
DESIRED=`get_DESIRED_Sites $COLLECTOR1` || exit 6
DESIANA=`get_DESIRED_Sites $COLLECTOR1 \
-const '(AcctGroup=?="analysis")'` || exit 7

# Print the table of pilots and pressure from queued jobs for each site
printf "%-20s%10s%10s%10s%10s%10s%10s%10s%10s%10s %-18s\n" "Site" "Pledge" "Pledged" "Analysis" "All" "Maximum" "Claimed" "Unclaimed" "Pressure" "Exclusive" "Maintenance"
printf "%30s%10s%10s%10s%10s%10s%10s%20s%10s\n" "Updated" "to CMS" "Usage 1m" "Usage 1m" "Usage 1m" "CPUs" "CPUs" "Pressure"
printf "%-20s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s %-18s\n" "Site" "Pledge" "Pledged" "Analysis" "All" "Maximum" "Claimed" "Unclaimed" "Pressure" "Exclusive" "Pressure" "Maintenance"
printf "%30s%10s%10s%10s%10s%10s%10s%20s%10s%10s\n" "Updated" "to CMS" "Usage 1m" "Usage 1m" "Usage 1m" "CPUs" "CPUs" "Pressure" "CRAB3"
echo

# Sum up some interesting quantities:
Expand All @@ -88,25 +90,28 @@ totalmaxusage=0
sites=`cat $SEDFILE | awk -F\/ '{print $3}' | sort | uniq`
for site in $sites ; do

# Claimed pilots at site
# Claimed CPUs at site
claimed=`grep \{$site\} $CLAIMED | awk '{print $1}'`
if [ "X"$claimed == "X" ] ; then claimed=0 ; fi
totalclaimed=$[$totalclaimed+$claimed]

# Idle pilots at site = running - claimed:
# Idle CPUs at site = running - claimed:
unclaimed=`grep \{$site\} $RUNNING | awk -v x=$claimed '{print $1-x}'`
if [ "X"$unclaimed == "X" ] ; then unclaimed=0 ; fi
totalunclaimed=$[$totalunclaimed+$unclaimed]

# Get queeud jobs for site (not exclusively):
pressure=`grep $site $DESIRED | wc -l`
pressana=`grep $site $DESIANA | wc -l`

# Get jobs queued only for this site:
exclusivepressure=`grep $site $DESIRED | awk -v site=$site '$1==site{print $0}' | wc -l`
exclusivepressure=`grep $site $DESIRED \
| awk -v site=$site '$1==site{print $0}' | wc -l`
totalexclusivepressure=$[$totalexclusivepressure+$exclusivepressure]

# Extract pledge for this site (total for all activities):
# Federation pledges may have duplicated entries (one SiteDB, one REBUS), so take the last one.
# Federation pledges may have duplicated entries (one SiteDB, one REBUS),
# so take the last one.
pledge=`grep ^$site\, $PLEDGES | tail -1 | awk -F\, '{print int($2)}'`
if [ "X"$pledge == "X" ] ; then pledge=0 ; fi
totalpledge=$[$totalpledge+$pledge]
Expand Down Expand Up @@ -144,7 +149,7 @@ for site in $sites ; do
fi
fi

printf "%-20s%10s%10s%10s%10s%10s%10s%10s%10s%10s %-18s\n" $site $validityofpledge $pledge $avgusage $allusage $maxusage $claimed $unclaimed $pressure $exclusivepressure "$downtime"
printf "%-20s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s %-18s\n" $site $validityofpledge $pledge $avgusage $allusage $maxusage $claimed $unclaimed $pressure $exclusivepressure $pressana "$downtime"

done

Expand Down
13 changes: 8 additions & 5 deletions condor_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ get_pilot_cpus_by_site() {
}

get_DESIRED_Sites() {
# TODO: Weigh by CPUs for multi-threaded jobs
# TODO: Weigh by RequestCPUs if defined
#
# Get all queued jobs' DESIRED_Sites, translating from DESIRED_SEs
# if needed (i.e. for CRAB2). If DESIRED_Sites exists, take that.
Expand All @@ -89,7 +89,7 @@ get_DESIRED_Sites() {
# run on a schedd and are not counted here.
#
# Usage:
# get_DESIRED_Sites $POOLNAME
# get_DESIRED_Sites $POOLNAME [optional args for condor_status]
# Output:
# File name of temporary file containing the list of DESIRES_Sites,
# one line per job.
Expand All @@ -100,13 +100,16 @@ get_DESIRED_Sites() {
SEDFILE=`translate_se_names_in_sitedb_to_cmssite`

# we could use the -global option to condor_q and not specify the SCHEDD list
SCHEDDS=`condor_status -pool $POOLNAME -const '(TotalIdleJobs>0)' -schedd -format ' -name %s' Name ` || return 1
SCHEDDS=`condor_status -pool $POOLNAME -const '(TotalIdleJobs>0)' \
-schedd -format ' -name %s' Name ` || return 1
DESIRED=`mktemp -t DESIRED.txt.XXXXXXX` || return 2

# run condor_q if there are queued jobs in the pool only:
if [ `echo $SCHEDDS | wc -w` -ne 0 ] ; then
condor_q $SCHEDDS -pool $POOLNAME -const '(JobStatus=?=1)' \
-format '%s' DESIRED_Sites -format ' %s' DESIRED_SEs -format ' %s\n' Owner \
condor_q $SCHEDDS -pool $@ -const '(JobStatus=?=1)' \
-format '%s' DESIRED_Sites \
-format ' %s' DESIRED_SEs \
-format ' %s\n' Owner \
| sed 's/undefined//g' | awk '{print $1}' | sed -f $SEDFILE >> $DESIRED
fi

Expand Down

0 comments on commit d6f6452

Please sign in to comment.