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

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

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

 ##########
 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:
   Why? I'd have thought Void would be the obvious choice here. (Changed to 
bytes for consistency.)

----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 113354)
    Time Spent: 1h  (was: 50m)

> 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: 1h
>  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