beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-5707) Add a portable Flink streaming synthetic source for testing
Date Sat, 13 Oct 2018 00:52:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 13/Oct/18 00:51
            Start Date: 13/Oct/18 00:51
    Worklog Time Spent: 10m 
      Work Description: mwylde commented on a change in pull request #6637: [BEAM-5707] Add
a periodic, streaming impulse source for Flink portable pipelines
URL: https://github.com/apache/beam/pull/6637#discussion_r224944097
 
 

 ##########
 File path: runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPortablePipelineTranslator.java
 ##########
 @@ -406,6 +417,56 @@ private void translateImpulse(
     context.addDataStream(Iterables.getOnlyElement(pTransform.getOutputsMap().values()),
source);
   }
 
+  @AutoService(NativeTransforms.IsNativeTransform.class)
+  public static class IsFlinkNativeTransform implements NativeTransforms.IsNativeTransform
{
+    @Override
+    public boolean test(RunnerApi.PTransform pTransform) {
+      return STREAMING_IMPULSE_TRANSFORM_URL.equals(PTransformTranslation.urnForTransformOrNull(pTransform));
+    }
+  }
+
+  private void translateStreamingImpulse(
+      String id, RunnerApi.Pipeline pipeline, StreamingTranslationContext context) {
+    RunnerApi.PTransform pTransform = pipeline.getComponents().getTransformsOrThrow(id);
+
+    ObjectMapper objectMapper = new ObjectMapper();
+
+    int intervalMillis;
+    int messageCount;
+    try {
+      JsonNode config = objectMapper.readTree(pTransform.getSpec().getPayload().toByteArray());
+      intervalMillis = config.path("interval_ms").asInt(100);
+      messageCount = config.path("message_count").asInt(0);
+    } catch (IOException e) {
+        throw new RuntimeException("Failed to parse configuration for streaming impulse",
e);
+    }
+
+    DataStreamSource<WindowedValue<byte[]>> source =
+        context
+            .getExecutionEnvironment()
+            .addSource(
+                new RichParallelSourceFunction<WindowedValue<byte[]>>() {
 
 Review comment:
   👍 I've moved it to org.apache.beam.runners.flink.translation.wrappers.streaming.io

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


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

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

> Add a portable Flink streaming synthetic source for testing
> -----------------------------------------------------------
>
>                 Key: BEAM-5707
>                 URL: https://issues.apache.org/jira/browse/BEAM-5707
>             Project: Beam
>          Issue Type: Improvement
>          Components: runner-flink
>            Reporter: Micah Wylde
>            Assignee: Aljoscha Krettek
>            Priority: Minor
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Currently there are no built-in streaming sources for portable pipelines. This makes
it hard to test streaming functionality in the Python SDK.
> It would be very useful to add a periodic impulse source that (with some configurable
frequency) outputs an empty byte array, which can then be transformed as desired inside the
python pipeline. More context in this [mailing list discussion|https://lists.apache.org/thread.html/b44a648ab1d0cb200d8bfe4b280e9dad6368209c4725609cbfbbe410@%3Cdev.beam.apache.org%3E].



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

Mime
View raw message