[ 
https://issues.apache.org/jira/browse/BEAM-3884?focusedWorklogId=113342&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-113342
 ]

ASF GitHub Bot logged work on BEAM-3884:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Jun/18 19:54
            Start Date: 19/Jun/18 19:54
    Worklog Time Spent: 10m 
      Work Description: angoenka commented on a change in pull request #5685: 
[BEAM-3884] Use Impulse primitive for Read.
URL: https://github.com/apache/beam/pull/5685#discussion_r196554550
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/core.py
 ##########
 @@ -1894,3 +1895,26 @@ def _create_source(serialized_values, coder):
     from apache_beam.transforms.create_source import _CreateSource
 
     return _CreateSource(serialized_values, coder)
+
+
+class Impulse(PTransform):
+    """Impulse primitive."""
+
+    def expand(self, pbegin):
+        if not isinstance(pbegin, pvalue.PBegin):
+          raise TypeError(
+            'Input to Impulse transform must be a PBegin but found %s' % 
pbegin)
+        return pvalue.PCollection(pbegin.pipeline)
+
+    def get_windowing(self, inputs):
+        return Windowing(GlobalWindows())
+
+    def infer_output_type(self, unused_input_type):
+        return type(None)
 
 Review comment:
   In java Impulse is of type ByteArray Should we keep it the same here.
   
https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Impulse.java

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 113342)
    Time Spent: 0.5h  (was: 20m)

> Python SDK supports Impulse as a primitive transform
> ----------------------------------------------------
>
>                 Key: BEAM-3884
>                 URL: https://issues.apache.org/jira/browse/BEAM-3884
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Ben Sidhom
>            Assignee: Robert Bradshaw
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Portable runners require Impulse to be the only root nodes of pipelines. The 
> Python SDK should provide this for pipeline construction.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to