IBMStreams / streamsx.topology

Develop streaming applications for IBM Streams in Python, Java & Scala.
http://ibmstreams.github.io/streamsx.topology
Apache License 2.0
29 stars 43 forks source link

Python: Ability to handle received punctuations in for_each and streamsx.spl.spl.PrimitiveOperator #2520

Closed markheger closed 4 years ago

markheger commented 4 years ago

Need support for work with received window punctuation markers in SPL Python primitive operator and Sink.

Example definition of an SPL Python primitive operator with punctuation handling::

    @spl.primitive_operator(output_ports=['A'])
    class SimpleForwarder(spl.PrimitiveOperator):
    def __init__(self):
        pass

    @spl.input_port()
    def port0(self, *t):
        self.submit('A', t)

    def on_punct(self):
        self.submit_punct('A')

Example definition with handling window punctuations SPL Python primitive sink operator::

    @spl.for_each(style='position')
    class PrintPunct(object):
        def __init__(self): 
            pass

        def __call__(self, value):
            assert value > 0

        def on_punct(self):
            print('window marker received')
markheger commented 4 years ago

merged to branch feature/punct

markheger commented 4 years ago

Stream.for_each() support punctuation handling

            class FEClass(object):
                def __call__(self, t):
                    return None

                def on_punct(self):
                    print ('window punctuation marker received')
                    ...

            ...
            s.for_each(FEClass(), name='SinkHandlingPunctuations', process_punct=True)
markheger commented 4 years ago

Stream.for_each() merged to feature/punct branch

markheger commented 4 years ago

merged to develop branch for 1.16.0a