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

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

                Author: ASF GitHub Bot
            Created on: 24/Oct/18 14:09
            Start Date: 24/Oct/18 14:09
    Worklog Time Spent: 10m 
      Work Description: mxm closed pull request #6810: [BEAM-5848] Fix coder 
for streaming impulse source
URL: https://github.com/apache/beam/pull/6810
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPortablePipelineTranslator.java
 
b/runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPortablePipelineTranslator.java
index 2b276f404c7..d228963237c 100644
--- 
a/runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPortablePipelineTranslator.java
+++ 
b/runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPortablePipelineTranslator.java
@@ -426,10 +426,13 @@ private void translateStreamingImpulse(
       String id, RunnerApi.Pipeline pipeline, StreamingTranslationContext 
context) {
     RunnerApi.PTransform pTransform = 
pipeline.getComponents().getTransformsOrThrow(id);
 
-    ObjectMapper objectMapper = new ObjectMapper();
+    TypeInformation<WindowedValue<byte[]>> typeInfo =
+        new CoderTypeInformation<>(
+            WindowedValue.getFullCoder(ByteArrayCoder.of(), 
GlobalWindow.Coder.INSTANCE));
 
-    int intervalMillis;
-    int messageCount;
+    ObjectMapper objectMapper = new ObjectMapper();
+    final int intervalMillis;
+    final int messageCount;
     try {
       JsonNode config = 
objectMapper.readTree(pTransform.getSpec().getPayload().toByteArray());
       intervalMillis = config.path("interval_ms").asInt(100);
@@ -438,10 +441,11 @@ private void translateStreamingImpulse(
       throw new RuntimeException("Failed to parse configuration for streaming 
impulse", e);
     }
 
-    DataStreamSource<WindowedValue<byte[]>> source =
+    SingleOutputStreamOperator<WindowedValue<byte[]>> source =
         context
             .getExecutionEnvironment()
-            .addSource(new StreamingImpulseSource(intervalMillis, 
messageCount));
+            .addSource(new StreamingImpulseSource(intervalMillis, 
messageCount))
+            .returns(typeInfo);
 
     
context.addDataStream(Iterables.getOnlyElement(pTransform.getOutputsMap().values()),
 source);
   }
diff --git 
a/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/io/StreamingImpulseSource.java
 
b/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/io/StreamingImpulseSource.java
index b27a36924b0..89d8f78e852 100644
--- 
a/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/io/StreamingImpulseSource.java
+++ 
b/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/io/StreamingImpulseSource.java
@@ -59,7 +59,9 @@ public void run(SourceContext<WindowedValue<byte[]>> ctx) {
       }
 
       try {
-        Thread.sleep(intervalMillis);
+        if (intervalMillis > 0) {
+          Thread.sleep(intervalMillis);
+        }
       } catch (InterruptedException e) {
         LOG.warn("Interrupted while sleeping", e);
       }


 

----------------------------------------------------------------
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: 158157)
    Time Spent: 0.5h  (was: 20m)

> Flink runner synthetic source with forward stream causes job failure
> --------------------------------------------------------------------
>
>                 Key: BEAM-5848
>                 URL: https://issues.apache.org/jira/browse/BEAM-5848
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-flink
>            Reporter: Thomas Weise
>            Assignee: Thomas Weise
>            Priority: Minor
>         Attachments: image-2018-10-23-20-46-58-991.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Running the synthetic source example (which is generating empty byte arrays) 
> with operator chaining disabled (which is causing said empty byte arrays to 
> be transmitted over forward stream) cause the job to fail after a few seconds.



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

Reply via email to