-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathqtimes
executable file
·85 lines (71 loc) · 1.73 KB
/
qtimes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/gawk -f
# Extract job timings from condor logs
# All logs have 'submitted' and either 'aborted' or 'terminated' lines, but
# this should be checked
# Usage:
# ./qtime -vFACTORY=aipanda024 UKI-NORTHGRID-LANCS*/*log
function csvout(event, delta)
{
OFS=","
print (FACTORY, jobid, q, tsub, event, delta)
}
function stamp()
{
# condor log excludes any year field so assume current year
# obvious caution if this assumption is not true
split($3,d,"/")
gsub(/:/," ",$4)
return mktime(strftime("%Y") " " d[1] " " d[2] " " $4)
}
FNR == 1 {
n = split(FILENAME,arr,"/")
q = arr[n-1]
}
BEGIN {
print "factory,jobid,queue,tsub,event,delta"
}
match($0, /Job submitted from host/) {
t = stamp()
tsub = t
submitted[NR] = tsub
gsub(/[(¦)]/, "", $2)
jobid = $2
}
match($0, /Job was held/) {
t = stamp()
delta = t - tsub
gridsub[NR] = tgrid
csvout("t2held", delta)
}
match($0, /Job submitted to grid resource/) {
t = stamp()
delta = t - tsub
gridsub[NR] = tgrid
csvout("t2grid", delta)
}
match($0, /Job was aborted by the user/) {
t = stamp()
delta = t - tsub
aborted[NR] = delta
csvout("t2abort", delta)
}
match($0, /Job executing on host/) {
t = stamp()
delta = t - tsub
executed[NR] = delta
csvout("t2exe", delta)
}
match($0, /Job terminated/) {
t = stamp()
delta = t - tsub
terminated[NR] = delta
csvout("t2term", delta)
}
# end of each file FNR==xxx ??
# print single record here containing all times per .log file??
END {
hdr = "%-45s %-12s %-12s %-12s %-6s\n"
printf hdr, "Queue", "Submitted", "Terminated", "Aborted", "Sanity"
fmt = "%-45s %-12d %-12d %-12d %-6d\n"
printf(fmt, q, length(submitted), length(terminated), length(aborted), length(submitted)-length(terminated)-length(aborted))
}