{"id":5463,"date":"2016-05-03T11:20:37","date_gmt":"2016-05-03T16:20:37","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=5463"},"modified":"2016-05-03T11:20:37","modified_gmt":"2016-05-03T16:20:37","slug":"parsing-odi-logs-for-scenario-run-time","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2016\/05\/03\/parsing-odi-logs-for-scenario-run-time\/","title":{"rendered":"Parsing ODI logs for scenario run time"},"content":{"rendered":"<p>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.<\/p>\n<pre>\r\n#!\/usr\/bin\/python\r\n#get each component with a start and stop\r\nfrom datetime import datetime\r\nscenarios = dict()\r\nfor line in open(\"odiagent.log\"):\r\n  tmp = line.replace(\"[\",\"\").replace(\"]\",\"\").split()\r\n  for i in range(len(tmp)):\r\n    if tmp[i].find(\"oracle.odi.runtime.ScenarioName\") > -1 and line.find(\"started session\") > -1:\r\n      scenarios[tmp[i + 1] + \" \" + str(tmp[6])] = tmp[0]\r\n    if tmp[i].find(\"oracle.odi.runtime.ScenarioName\") > -1 and line.find(\"successfully completed session\") > -1:\r\n      if tmp[i + 1] + \" \" + str(tmp[6]) in scenarios:\r\n        scenarios[tmp[i + 1] + \" \" + str(tmp[6])] = [scenarios[tmp[i + 1] + \" \" + str(tmp[6])],tmp[0]]\r\n\r\nfor i in scenarios:\r\n  if len(scenarios[i]) == 2:\r\n    start = datetime.strptime(scenarios[i][0].split(\".\")[0], '%Y-%m-%dT%H:%M:%S')\r\n    end = datetime.strptime(scenarios[i][1].split(\".\")[0], '%Y-%m-%dT%H:%M:%S')\r\n    print i.ljust(60,\" \") + str(end - start)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2016\/05\/03\/parsing-odi-logs-for-scenario-run-time\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[68],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5463"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=5463"}],"version-history":[{"count":1,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5463\/revisions"}],"predecessor-version":[{"id":5465,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5463\/revisions\/5465"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=5463"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=5463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}