Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scott Chapman – American Electric Power Paper 9015 Session 331.

Similar presentations


Presentation on theme: "Scott Chapman – American Electric Power Paper 9015 Session 331."— Presentation transcript:

1 Scott Chapman – American Electric Power Paper 9015 Session 331

2 Agenda What I mean by critical path My simple way of finding it Review some sample code Questions Bonus Material

3 Geek-required xkcd reference

4 Critical path Simple definition: how long is this going to take? Longest sequence of activities In a project In a batch schedule Need to look at: Predecessor-successor relationships Durations Time dependencies Ideas originated in Project Management

5 Project Management History Critical Path Method (CPM) originated at DuPont in 1950s Used to manage chemical plant maintenance projects Critical path is the sequence of events which determines the duration of the project Delays in tasks on the CP delay the entire project CP must be managed to stay on schedule To finish project earlier, tasks on CP must be somehow shortened

6 CPM process Identify activities Identify sequence and dependencies Draw network diagram of activities Estimate duration of activities Identify the longest path in the network (critical path) Monitor & update as project progresses Delays in tasks not on CP may change the CP!

7 Batch Windows & CP Business runs on cycles Daily, weekly, monthly processes Large applications have large batch schedules Batch schedules can be drawn as a network diagram Predecessor – Successor relationships between jobs Like projects, we like our batch windows to finish on time! Like a project, a batch schedule has a CP

8 CP Calculation Formally: CP is path with no slack for any task Slack = difference between earliest & latest start or finish time of task Latest finish = latest time task can finish without delaying project And how do you figure that??? Informally: Find all the paths through the network diagram Add up task duration on each path Select the longest path

9 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

10 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

11 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

12 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

13 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

14 Simple example Five paths through this simple example Task A Task D Task B Task C Task E Task F StartEnd

15 Simple example Calculate path durations from task durations Task A Task D Task B Task C Task E Task F StartEnd 15 mins 30 mins 20 mins 15 mins 10 mins 5 mins A+B+E = 45 A+C+E = 40 A+C+F = 35 D+C+E = 55 D+C+F = 50

16 Simple example Calculate path durations from task durations Task A Task D Task B Task C Task E Task F StartEnd 15 mins 30 mins 20 mins 15 mins 10 mins 5 mins A+B+E = 45 A+C+E = 40 A+C+F = 35 D+C+E = 55 D+C+F = 50

17 So thats simple enough! Everybody ready to leave?

18 Real world complications Hundreds or thousands of batch jobs Managed by a batch scheduler package Time-of-day dependencies Extraneous dependencies New jobs added without cleaning up obsolete dependencies Variable execution times Variation in data to be processed Contention with other processes External waits Job failures

19 What that might look like… Winding your way through that mess is a bit more complicated!

20 Tooling Options Package from scheduler vendor + Should be well integrated - Cost? Microsoft Project - Not really meant for this purpose + See CMG Proceedings: Schwarz/Aurand, 1999 and Zaslavsky, 2001 SAS/OR - Cost and effort? Roll your own + Can make output exactly what you want - Time / effort + Sample code on your CD!

21 What is the real question? 1. What is the longest path through the schedule? - prediction of the critical path - usually one-time analysis 2. Why did job X finish late last night? - an ongoing question / process - requires the CP for job X Fortunately, #2 is much easier!

22 Use what you know Predecessors (from batch scheduler) End times (from actual executions) We are answering a question, not predicting the future We just need to explain what happened Look at the jobs in the critical path for job X for anomalies

23 Critical path simplified Start at job X Find the predecessor that ended last – that was the critical predecessor to X Call that job W Find last predecessor of W, call it V Repeat until: You go back some number of levels or You reach a time dependency Resulting list is the critical path, for the day under study, for job X

24 Simple example Task A Task D Task B Task C Task E Task F Start 19:00 End 15 mins 30 mins 20 mins 15 mins 10 mins 5 mins 19:15 19:30 19:35 19:45 19:55 19:50

25 Working backwards… Task A Task D Task B Task C Task E Task F Start 19:00 End 19:15 19:30 19:35 19:45 19:55 19:50 E ended last

26 What is Es last predecessor? Task A Task D Task B Task C Task E Task F Start 19:00 End 19:15 19:30 19:35 19:45 19:55 19:50 E ended last C ended after B

27 What is Cs last predecessor? Task A Task D Task B Task C Task E Task F Start 19:00 End 19:15 19:30 19:35 19:45 19:55 19:50 E ended last C ended after B D ended after A

28 Critical Path is E – C – D Task A Task D Task B Task C Task E Task F Start 19:00 End 19:15 19:30 19:35 19:45 19:55 19:50 Tasks A, B, F had no direct bearing on the end time

29 Complicating simplicity… Schedule changes every day Weekly / monthly processing Application changes Schedule relationships may not be pristine Jobs may be run multiple timesbe sure to use the correct instance If you want to graph the entire schedule it gets more complicated

30 Why bother finding the CP? Limit the data you need to look at to investigate a late-finishing job The cause is on the CP Find changes If the CP changes day to day: why? Investigate impact of periodic schedule differences Addition of monthly processing jobs may change the CP

31 What I do Capture job stats every day to a performance database Standard practice Extract history daily to XML file Extract schedule once per day and store for 45 days Saved as XML files Allows historical investigation JavaScript browser application pulls both data sources and allows for investigation

32 Sample application Input #1: Schedule XML file CPUJ Online Bill Image xtract #AMCSMISCBILL 81 … #AMCSMISCBILL 78 #SMCSDAILYRPTS 3 … #AMCSDLYBKUP 6 CPUJ Load O/L Bill Image #AMCSMISCBILL 87 #AMCSMISCBILL 91 A grouping of jobs is an application A job is an operation Each job has predecessors and successors Arrival time is the earliest the job can run

33 Sample application Input #2: Job Data XML file COCJ 0 MCSX CO1J Jobs by name here Norms, averages, maximums May have multiple runs per day Read, start, end times Note relatively compact format designed to reduce the file sizeunfortunately that increases the complexity of interpreting the data Stats for single run

34 Sample application output

35 Compare days in two windows

36 Why later on 12/29?

37 Completely different CP here

38 Critical path comes back together here

39 Heres an ET difference of >1 hour and CPU >2x increase!

40 Sample application details On CD at back of room Very simple example coded quickly one Sunday afternoon May not be bug free Will not satisfy all your needs For illustrative purposes only – easier to understand than the examples in the paper HTML / JavaScript application Data is in XML files Internet Explorer only Uses XPath & XSLT Beyond the scope of this presentation

41 Application flow When HTML page loads Calls init() to load the XML files Selection criteria populated in HTML When user clicks Find It button Calls findIt() to find the critical path, which in turn calls: getRunsDate(job, date) – returns array of executions of a job on a given batch date getLatestPred(job, app) – returns predecessor that ran last getRunsDate is an example of using DOM functions to extract data from XML

42 Critical parts of the code

43 findIt() Get runs for this job and date Save stats for this job to array Then find preds and add them to the array Loop through array and build HTML table

44 getLatestPred(cjob, capp) XPath to get array of preds Use DOM calls to get data from XML Xpath to find job name from op id Get the runs for a pred job Check run to see if it is the latest pred so far If it is, save it

45 Thats essentially it! getRunsDate(job, date) is nothing special – simply retrieves list of runs from the XML file Typical housekeeping code initializing variables, etc. Sample in the paper was much more complicated due to it being pulled from the application that does the graphing

46 Summary Critical Path Analysis for Performance Analysis usually involves answering why, not predicting the future In such a case, start at the end and work backwards That type of analysis is easy to code Record a snapshot of the schedule daily as well as the job performance

47 Questions / comments ?

48 Bonus material: Export to Excel! Sometimes you need to play with your data Copy to Excel to Re-sort Filter Pivot tables Graph Summarize Cut and paste HTML tables works well Even better: automate it

49 New & improved:

50

51 sendExcel() function on CD If Excel not open, open it If previous workbook not open Open a new workbook Add new sheet to work book with data Requires IE and Excel

52 Useful references XPath, XSLT, XML quick reference cards Browser Book for Web Designers Humor for geeks


Download ppt "Scott Chapman – American Electric Power Paper 9015 Session 331."

Similar presentations


Ads by Google