Pretty random, but I needed this earlier this morning to troubleshoot a heap sizing issue in the ODI domain. This will print the scenario, the tid associated (needed if the same scenario is run more than once concurrently), and the run time.
#!/usr/bin/python
#get each component with a start and stop
from datetime import datetime
scenarios = dict()
for line in open("odiagent.log"):
tmp = line.replace("[","").replace("]","").split()
for i in range(len(tmp)):
if tmp[i].find("oracle.odi.runtime.ScenarioName") > -1 and line.find("started session") > -1:
scenarios[tmp[i + 1] + " " + str(tmp[6])] = tmp[0]
if tmp[i].find("oracle.odi.runtime.ScenarioName") > -1 and line.find("successfully completed session") > -1:
if tmp[i + 1] + " " + str(tmp[6]) in scenarios:
scenarios[tmp[i + 1] + " " + str(tmp[6])] = [scenarios[tmp[i + 1] + " " + str(tmp[6])],tmp[0]]
for i in scenarios:
if len(scenarios[i]) == 2:
start = datetime.strptime(scenarios[i][0].split(".")[0], '%Y-%m-%dT%H:%M:%S')
end = datetime.strptime(scenarios[i][1].split(".")[0], '%Y-%m-%dT%H:%M:%S')
print i.ljust(60," ") + str(end - start)