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

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

                Author: ASF GitHub Bot
            Created on: 22/Mar/18 00:43
            Start Date: 22/Mar/18 00:43
    Worklog Time Spent: 10m 
      Work Description: lukecwik closed pull request #4913: [BEAM-3897] Add Go 
wordcount example with multi output DoFns
URL: https://github.com/apache/beam/pull/4913
 
 
   

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/sdks/go/examples/multiout/multiout.go 
b/sdks/go/examples/multiout/multiout.go
new file mode 100644
index 00000000000..43b480dbf5d
--- /dev/null
+++ b/sdks/go/examples/multiout/multiout.go
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// multiout is a wordcount variation that uses a multi-outout DoFn
+// and writes 2 output files.
+package main
+
+import (
+       "context"
+       "flag"
+       "fmt"
+       "log"
+       "regexp"
+
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/io/textio"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+       "github.com/apache/beam/sdks/go/pkg/beam/x/beamx"
+)
+
+var (
+       input = flag.String("input", 
"gs://apache-beam-samples/shakespeare/kinglear.txt", "File(s) to read.")
+       small = flag.String("small", "", "Output file for small words 
(required).")
+       big   = flag.String("big", "", "Output file for big words (required).")
+)
+
+var wordRE = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
+
+func splitFn(line string, big, small func(string)) {
+       for _, word := range wordRE.FindAllString(line, -1) {
+               if len(word) > 5 {
+                       big(word)
+               } else {
+                       small(word)
+               }
+       }
+}
+
+func formatFn(w string, c int) string {
+       return fmt.Sprintf("%s: %v", w, c)
+}
+
+func writeCounts(s beam.Scope, col beam.PCollection, filename string) {
+       counted := stats.Count(s, col)
+       textio.Write(s, filename, beam.ParDo(s, formatFn, counted))
+}
+
+func main() {
+       flag.Parse()
+       beam.Init()
+
+       if *small == "" || *big == "" {
+               log.Fatal("No outputs provided")
+       }
+
+       p := beam.NewPipeline()
+       s := p.Root()
+
+       lines := textio.Read(s, *input)
+       bcol, scol := beam.ParDo2(s, splitFn, lines)
+       writeCounts(s, bcol, *big)
+       writeCounts(s, scol, *small)
+
+       if err := beamx.Run(context.Background(), p); err != nil {
+               log.Fatalf("Failed to execute job: %v", err)
+       }
+}


 

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

> Flink runners fails on multioutput portable pipeline
> ----------------------------------------------------
>
>                 Key: BEAM-3897
>                 URL: https://issues.apache.org/jira/browse/BEAM-3897
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-flink
>            Reporter: Henning Rohde
>            Assignee: Ben Sidhom
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When trying a Go pipeline with a 2-output DoFn on the hacking branch, I see:
> [flink-runner-job-server] ERROR 
> org.apache.beam.runners.flink.FlinkJobInvocation - Error during job 
> invocation go-job-1521582585657843000_-2121541089_763230090.
> java.lang.RuntimeException: Pipeline execution failed
>       at org.apache.beam.runners.flink.FlinkRunner.run(FlinkRunner.java:134)
>       at 
> org.apache.beam.runners.flink.FlinkJobInvocation.lambda$start$0(FlinkJobInvocation.java:61)
>       at 
> org.apache.beam.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
>       at 
> org.apache.beam.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
>       at 
> org.apache.beam.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.flink.runtime.client.JobExecutionException: Job 
> execution failed.
>       at 
> org.apache.flink.runtime.jobmanager.JobManager$$anonfun$handleMessage$1$$anonfun$applyOrElse$6.apply$mcV$sp(JobManager.scala:897)
>       at 
> org.apache.flink.runtime.jobmanager.JobManager$$anonfun$handleMessage$1$$anonfun$applyOrElse$6.apply(JobManager.scala:840)
>       at 
> org.apache.flink.runtime.jobmanager.JobManager$$anonfun$handleMessage$1$$anonfun$applyOrElse$6.apply(JobManager.scala:840)
>       at 
> scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
>       at 
> scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
>       at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
>       at 
> akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:415)
>       at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
>       at 
> scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
>       at 
> scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
>       at 
> scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
> Caused by: java.lang.RuntimeException: 
> java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: 
> expected one element but was: <0, 1>
>       at 
> org.apache.beam.runners.flink.translation.functions.FlinkExecutableStageFunction.lambda$mapPartition$0(FlinkExecutableStageFunction.java:176)
>       at java.util.HashMap$Values.forEach(HashMap.java:980)
>       at 
> org.apache.beam.runners.flink.translation.functions.FlinkExecutableStageFunction.mapPartition(FlinkExecutableStageFunction.java:172)
>       at 
> org.apache.flink.runtime.operators.MapPartitionDriver.run(MapPartitionDriver.java:103)
>       at org.apache.flink.runtime.operators.BatchTask.run(BatchTask.java:490)
>       at 
> org.apache.flink.runtime.operators.BatchTask.invoke(BatchTask.java:355)
>       at org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: java.util.concurrent.ExecutionException: 
> java.lang.IllegalArgumentException: expected one element but was: <0, 1>
>       at 
> org.apache.beam.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:500)
>       at 
> org.apache.beam.util.concurrent.AbstractFuture.get(AbstractFuture.java:479)
>       at 
> org.apache.beam.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:76)
>       at 
> org.apache.beam.sdk.fn.data.SettableFutureInboundDataClient.awaitCompletion(SettableFutureInboundDataClient.java:41)
>       at 
> org.apache.beam.sdk.fn.data.BeamFnDataInboundObserver.awaitCompletion(BeamFnDataInboundObserver.java:89)
>       at 
> org.apache.beam.runners.flink.translation.functions.FlinkExecutableStageFunction.lambda$mapPartition$0(FlinkExecutableStageFunction.java:174)
>       ... 7 more
> Caused by: java.lang.IllegalArgumentException: expected one element but was: 
> <0, 1>
>       at org.apache.beam.collect.Iterators.getOnlyElement(Iterators.java:322)
>       at org.apache.beam.collect.Iterables.getOnlyElement(Iterables.java:294)
>       at 
> org.apache.beam.runners.flink.translation.functions.FlinkExecutableStageFunction$1$1.accept(FlinkExecutableStageFunction.java:149)
>       at 
> org.apache.beam.runners.flink.translation.functions.FlinkExecutableStageFunction$1$1.accept(FlinkExecutableStageFunction.java:135)
>       at 
> org.apache.beam.sdk.fn.data.BeamFnDataInboundObserver.accept(BeamFnDataInboundObserver.java:80)
>       at 
> org.apache.beam.sdk.fn.data.BeamFnDataInboundObserver.accept(BeamFnDataInboundObserver.java:32)
>       at 
> org.apache.beam.sdk.fn.data.BeamFnDataGrpcMultiplexer$InboundObserver.onNext(BeamFnDataGrpcMultiplexer.java:135)
>       at 
> org.apache.beam.sdk.fn.data.BeamFnDataGrpcMultiplexer$InboundObserver.onNext(BeamFnDataGrpcMultiplexer.java:123)
>       at io.grpc.stub.ServerCalls$2$1.onMessage(ServerCalls.java:204)
>       at 
> io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messageRead(ServerCallImpl.java:242)
>       at 
> io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1.runInContext(ServerImpl.java:568)
>       at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
>       at 
> io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:152)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at java.util.co



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

Reply via email to