Parsing ODI logs for scenario run time

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)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.