Observing the behavior of the sample application
After you build and launch the sample application, you can observe application behavior by using the application user interface.
About this task
After you run the ./startApp.sh script, the Commodity Purchasing sample application desktop looks similar to the following example.
The Commodity Purchasing dashboard occupies most of the space, but notice that there are two xterm windows in the upper-right and lower-right corners.
Checking if required directories are present...
Creating data directory.
Creating toolkit directory.
After
a short time, the window begins to display the time that the data files were last
regenerated (approximately every 10 seconds). Ordinarily, you do not need to do
anything with this window other than note if it stops
updating.Data files for the user interface have been regenereated at 12:43:37 PM
Waiting 10 minutes before user-inititated purchases are allowed.
The Commodity Purchasing dashboard remains empty until enough data is available to determine the optimal supplier. Weather data, location statistics, and supplier scores are being analyzed and prepared before, but the ranking is made only after enough data is available and analyzed.
After a few minutes several things occur on the dashboard. Enough data is available to produce an initial set of supplier rankings. At this time, the supplier in Hallowell is found to have exceptionally fine-quality Infoberries with a score of 707. (Scores of 700 or higher are exceptional.) Thus, an automatic "opportunistic" purchase of 2500 bushels is performed from Hallowell, which is reflected in the second data point on the Projected Supply graph. At the same time, the act of purchasing from Hallowell causes its overall score to be lowered to 25 for the next 12 hours to ensure that another purchase from this supplier does not occur for at least that time period. The Purchase History graph reflects the automatic purchase. You are still not able to make user-initiated purchases because the 10 minute waiting period is not passed.
Waiting 10 minutes before user-initatited purchases are allowed...Press the enter key (with this window active) to purchase 2500 bushels.
2500 bushels purchased at :Tue 21 April 2009 12:46:30 PM CDT
To
prevent user-initiated purchases from being performed too closely together, a
delay of several seconds must elapse before the window is again ready to accept
purchases. At this time, the following message appears:
2500 bushels purchased at :Tue 21 April 2009 12:46:30 PM CDT
Press the enter key (with this window active) to purchase 2500 bushels
The
graphs and tables on the Commodity Purchasing dashboard reflect this purchase as
shown in the following example.The Projected Supply graph shows an increase of 2500 bushels, and the Purchase History table shows the latest purchase from Vero Beach, along with the bar chart and pie chart. Finally, the Supplier Ranking table now shows that Hallowell and Vero Beach are assigned overall scores of 25, removing them from probable consideration for at least the next 12 hours.
Also, the Supplier Ranking table shows all the available suppliers. Since Upper Tygart and Zwingle are in areas with a weather warning, their overall score is overridden to zero to ensure that there are not purchases from these suppliers during the warning.
The following figure shows an example of the same Commodity Purchasing dashboard after the application runs for about 18 hours.
The Purchase History table shows a total of five purchases – the two from Hallowell and Vero Beach, two additional "opportunistic" purchases that are made automatically, and a user-initiated purchase from Zwingle at the bottom of the table. In particular, notice that the opportunistic purchase at 3:16am from Hallowell occurred exactly 12 hours after the purchase at the top of the table. In other words, as soon as the 12 hour period expired that was capping Hallowell's score at 25, its score rose to 945 resulting in the automatic purchase.
To examine why Hallowell's scores are so high, consider the next figure. The constancy of temperature over the past 18 hours is the largest factor in the score. Also, the Recent Temps graph shows that the temperature hardly varies over the period in the graph.
You can view the application using the Streams Graph in the Streams Console.
Open the Streams Console.
Go to the instance drop-down, select your instance, and click Monitor Instance as in Figure 1.
From the Monitor Instance screen, maximize the Streams Graph panel to view the PE graph.
You can explore live details of the application by choosing different options from the Color Scheme drop-down. Hovering over a given operator box tells you which job that operator belongs to, along with other metrics details. Even though there are five separate jobs in this example, they work together to form one coherent application.