Run your application

You are now ready to run this program or, in Streams Studio parlance, launch the build.

  1. In the Project Explorer, right-click MyMainComposite. You might need to expand MyProject and my.name.space. Select Launch > Launch Active Build Config To Running Instance.
  2. In the Edit Configuration dialog, click Apply, and then click Launch.
    You can set or change several options when you launch an application. However, for now, ignore those options.
    The Streams Launch progress dialog appears briefly. To see what happened, switch consoles from the SPL Build to the Streams Studio console.
  3. In the Console view, click the Display Selected Console button on the right to switch consoles.


    The Streams Studio console shows that job number 0 was submitted to the instance called StreamsInstance in the domain StreamsDomain.
    Because nothing else seems to have happened, you need to look for some result of what you’ve done. First, you’ll view the job running in the instance. Then, you’ll inspect the results.

  4. Switch to the Streams Explorer, which is the second tab in the view on the left, behind the Project Explorer.
  5. Expand the StreamsDomains folder, and the Resources and Instances folders under that.
    The Resources folder refers to the machines that are available to the domain. In this virtual machine, there is only one. Resource tags let you dedicate different hosts to different purposes, such as running runtime services or application processes. In this single-resource environment, this is not relevant.
    Tip: For convenience, the Streams Jobs and Streams Instances folders repeat information from the Instances folders under the listed domains, but they lack further drill-down information.
    You know that you have one instance StreamsInstance in the domain StreamsDomain. The entry tells you that it is the default instance, where launched applications will run unless otherwise specified, that it is running and its current wall clock time. (You might need to widen the view to see the status.)
  6. Expand default:[email protected]. This shows a number of elements, but the only one you’re interested in is the last one, which is the job you have just submitted (a running application is called a job):
    0:my.name.space::MyMainComposite_0.
    Its status should be Healthy. There is much information here about a job and its constituent operators and Processing Elements (PEs), but you are going to graphically explore it instead.
    Tip for diagnosing problems: The most likely cause of an unhealthy job is a mistake in the FileSource’s file parameter, which isn’t caught by the compiler but can cause a “file not found” exception at runtime. More elaborate debugging, such as using trace files and other diagnostics, is beyond the scope of this lab.

  7. Right-click default:[email protected].
  8. Select Show Instance Graph.
    A new view opens in the bottom panel that shows a graph similar to that in the graphical editor. However, this one shows in real time what is running in the instance. If you launch multiple applications or multiple copies of the same application, you will see them all. You can inspect how data is flowing, see at a glance whether there are any runtime problems, and monitor other metrics.
    If necessary, expand or maximize the Instance Graph view. Click Fit to Content in the view’s toolbar.
    There is a lot more to the Instance Graph, but you will explore it further in the next lab.
  9. Hover over Filtered to see current information about data flows and other metrics. Among other things, it will tell you that the input received 1902 tuples, and the output sent 95 tuples. This seems reasonable, given that the output should be only a subset of the input. But it also says that the current tuple rate on both input and output is 0/sec, so no data is currently flowing. Why? Because it has read all the data in the all.cars file, and there will never be any more data.
  10. Inspect the results by looking at the input and output data.
    Note that Streams jobs run forever. The input data is exhausted but the job is still running. This is always true for a Streams application running in an instance (distributed applications): a job can be canceled only by manual (or scripted) intervention. In principle, a stream is infinite even though in some cases, such as when reading a single file, this might not be true.
  11. In the top menu, click File > Open File.
  12. In the Open File dialog, browse to streamsadmin/data/all.cars, and click OK. Studio opens the file in an editor view and shows location observations for multiple vehicle IDs: C127, C128, and so on.
  13. In the Project Explorer (the first tab in the view on the left), expand Resources. There should be a file under data, but there is no twisty in front of the directory.
  14. To update the view, right-click data, and select Refresh.
  15. Expand the twisty and double-click filtered.cars. This file contains coordinates, speeds, and headings only for vehicles C101 and C133.
    Tip for showing files side by side: You can show two editors side by side by dragging the tab of one of them to the right edge of the editor view. As you drag, outlines appear, which arrange themselves side by side as you approach the right edge. To undo this view, drag the tab back to a position among the other tabs or close it.