Script execution

This commit is contained in:
2019-04-02 10:22:12 +02:00
parent 33c616ebbd
commit 6651458323

View File

@@ -36,24 +36,28 @@ def _get_count(sql):
ret = results.getInt("count")
return ret
def get_count(command, result):
return _get_count("Command LIKE '"+ command +"' AND Result = '"+ result +"'")
def get_count(command= "%%", start = None, end = None, result= "%%"):
sql = "Command LIKE '"+ command +"' AND Result LIKE '"+ result +"'"
return _get_count(sql)
def print_stats(command):
def print_stats(command = "%", start = None, end = None):
print "Statistics for: " + command
s = get_count(command, "success")
a = get_count(command, "abort")
e = get_count(command, "error")
t=s+a+e
s = get_count(command, start, end, "success")
a = get_count(command, start, end, "abort")
e = get_count(command, start, end, "error")
t=s+a+e #get_count(command, start, end, "%")
if t==0:
print "No records"
else:
print "Success: ", ("%1.2f%% of %d" % ((float(s)/t) * 100, t))
print "Error: ", ("%1.2f%% of %d" % ((float(e)/t) * 100, t))
print "Abort: ", ("%1.2f%% of %d" % ((float(a)/t) * 100, t))
print_stats ("%test1.py")
cmd = "%test1.py"
start= ""
end= ""
print_stats ("%test1.py", start, end)