IBMStreams/streamsx.documentation

Update 1.6 dev gde section 4.1 Creating data sources

jakrmpotic opened this issue · 2 comments

To be updated: http://ibmstreams.github.io/streamsx.documentation/docs/python/1.6/python-appapi-devguide-4/

The Topology.source function is improved to allow an iterable to be passed directly to source, rather than requiring a function that returns an iterable. The existing api of  supplying a function that returns an iterable is still supported.
In a notebook environment this simplifies development of applications by not forcing a separate function (in a separate module) that returns the iterable.
For example, this is now valid:
topo = Topology("hello_world")
hw = topo.source(["Hello", "World!"])

@ddebrunner @wmarshall484 What does this mean in a Python env outside of notebooks? What is an example?

@jakrmpotic

What does this mean in a Python env outside of notebooks?

Nothing here is specific here to notebooks so I'm not sure I understand the question.

This section has been updated but now it no longer states that you can directly pass an iterable to the source function.
Secondly, in section 4.1, It says:

Having only a single source method may seem limiting as there are other types of sources such as event based or polling that don't seem to
fit the iterable model. However, the power of Python comes to the rescue!

From the temperature sensor example discussed earlier (temperator_sensor.py), the input to the source function is the user-supplied function temperature_sensor_functions.readings. The readings function produces data for the stream.

topo = Topology("temperature_sensor")
source =
    topo.source(temperature_sensor_functions.readings)

It isn't immediately clear the point that is being made here. This just demonstrates using user supplied function (which we have already discussed). How does this address the issue of event or polling based sources? Do you mean to refer to the use of yield by the readings function?