IBM Streams 4.2

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.

Figure 1. Commodity Purchasing sample application desktop
This figure shows an example of the Commodity Purchasing sample application desktop after you start the application.

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.

The User Interface Helper window is continuously running a shell script that performs various user-interface housekeeping tasks. Initially, you might see brief messages in this window as these two directories are created.
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
The User-Initiated Purchasing window is in the upper-right corner. Initially, this window does not allow user-initiated purchases to be performed. You must wait for 10 minutes to elapse to prevent user-initiated purchases from being made before enough data becomes available to determine the optimal supplier.
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.

Figure 2. Commodity Purchasing Dashboard initial state
This figure shows an example of the initial state of the Commodity Purchasing Dashboard.

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.

Figure 3. Commodity Purchasing Dashboard after a few minutes, which includes an automatic "opportunistic" purchase
This figure shows an example of the Commodity Purchasing Dashboard after a few minutes.
After the 10 minute waiting period expires, user-initiated purchases are allowed. An amended message appears in the User-Initiated Purchasing window.
Waiting 10 minutes before user-initatited purchases are allowed...
Press the enter key (with this window active) to purchase 2500 bushels.
To make a purchase, click the window and press the Enter key. The purchase is made from the supplier that was highest-ranked at this time, and it is documented with a confirmation in the User-Initiated Purchasing Window.
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.

Figure 4. Commodity Purchasing Dashboard after User-initiated Purchase
This figure shows an example of the Commodity Purchasing Dashboard after a user-initiated purchase.

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.

Figure 5. Commodity Purchasing Dashboard after several hours, with automatic, and user-initiated purchases
This figure shows an example of the Commodity Purchasing Dashboard after several hours, with automatic, and user-initiated purchases.

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.

Figure 6. Commodity Purchasing Dashboard Showing Detail Data for Hallowell
This figure illustrates the Commodity Purchasing Dashboard Showing Detail Data for Hallowell.

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.

Figure 7. Choose Monitor Instance in the Streams Console
This figure illustrates choosing Monitor Instance to view the Streams Graph.

From the Monitor Instance screen, maximize the Streams Graph panel to view the PE graph.

Figure 8. PE Graph
This figure illustrates a 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.