Posts Tagged ‘Negotiation Cycle’

Negotiation cycle statistics

March 29, 2010

If you have ever wondered how your Negotiator is doing, you may be interested in this AWK script. It summarizes negotiation cycles by reading NegotiatorLog output.

You can either pass it your NegotiatorLog or, if you want to only summarize recent cycles, combine tail -n and a pipe.

#!/usr/bin/awk -f

function parse_time(string) {
   return mktime(gensub(/([^/]*)\/([^ ]*) ([^:]*):([^:]*):([^ ]*) .*/,
                        "1984 \\1 \\2 \\3 \\4 \\5", "g"))
}

BEGIN { started = 0; finished = 0 }

/Started Negotiation Cycle/ {
   started = parse_time($0)
#   if (finished) print "Delay:", started - finished
   finished = 0; matched = 0; rejected = 0; submitters = 0; slots = 0
}

/Matched/ {
   matched += 1
}

/Rejected/ {
   rejected += 1
}

/Public ads include .* submitter, .* startd/ {
   submitters = $6
   slots = $8
}

/Finished Negotiation Cycle/ {
   finished = parse_time($0)
   if (!started) next #{ print "Skipping first cycle"; next }
#   if (!matched) next #{ print "Skipping cycle with no matches"; next }
   duration = finished - started
   if (!duration) next # { print "Skipping zero second cycle"; next }
   print strftime("%m/%d %T", started), "::",
       matched, "matches in",
       duration, "seconds",
       "(" matched / duration "/s) with",
       rejected, "rejections,",
       submitters, "submitters,",
       slots, "slots"
}

END {
   #if (!finished) print "Skipping last cycle"
}

Condor’s debug logs do not include a year or timezone in their timestamp, so cycles that span years or daylight savings periods will produce bogus results.


%d bloggers like this: