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-3856) Add prototype support for Go SDK streaming
Date Tue, 03 Apr 2018 23:45:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 03/Apr/18 23:44
            Start Date: 03/Apr/18 23:44
    Worklog Time Spent: 10m 
      Work Description: herohde commented on a change in pull request #4939: [BEAM-3856][BEAM-3854]
Add prototype of Go streaming on Dataflow with PubSub
URL: https://github.com/apache/beam/pull/4939#discussion_r178992732
 
 

 ##########
 File path: sdks/go/examples/streaming_wordcap/wordcap.go
 ##########
 @@ -0,0 +1,81 @@
+// 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.
+
+// streaming_wordcap is a toy streaming pipeline that uses PubSub. It
+// does the following:
+//    (1) create a topic and publish a few messages to it
+//    (2) start a streaming pipeline that converts the messages to
+//        upper case and logs the result.
+//
+// NOTE: it only runs on Dataflow and must be manually cancelled.
+package main
+
+import (
+	"context"
+	"flag"
+	"os"
+	"strings"
+
+	"github.com/apache/beam/sdks/go/pkg/beam"
+	"github.com/apache/beam/sdks/go/pkg/beam/core/util/stringx"
+	"github.com/apache/beam/sdks/go/pkg/beam/io/pubsubio"
+	"github.com/apache/beam/sdks/go/pkg/beam/log"
+	"github.com/apache/beam/sdks/go/pkg/beam/options/gcpopts"
+	"github.com/apache/beam/sdks/go/pkg/beam/util/pubsubx"
+	"github.com/apache/beam/sdks/go/pkg/beam/x/beamx"
+	"github.com/apache/beam/sdks/go/pkg/beam/x/debug"
+)
+
+var (
+	input = flag.String("input", os.ExpandEnv("$USER-wordcap"), "Pubsub input topic.")
+)
+
+var (
+	data = []string{
+		"foo",
+		"bar",
+		"baz",
+	}
+)
+
+func main() {
+	flag.Parse()
+	beam.Init()
+
+	ctx := context.Background()
+	project := gcpopts.GetProject(ctx)
+
+	log.Infof(ctx, "Publishing %v messages to: %v", len(data), *input)
+
+	defer pubsubx.CleanupTopic(ctx, project, *input)
+	sub, err := pubsubx.Publish(ctx, project, *input, data...)
+	if err != nil {
+		log.Fatal(ctx, err)
+	}
+
+	log.Infof(ctx, "Running streaming wordcap with subscription: %v", sub.ID())
+
+	p := beam.NewPipeline()
+	s := p.Root()
+
+	col := pubsubio.Read(s, project, *input, &pubsubio.ReadOptions{Subscription: sub.ID()})
+	str := beam.ParDo(s, stringx.FromBytes, col)
+	cap := beam.ParDo(s, strings.ToUpper, str)
 
 Review comment:
   It does not. Function registration is just a tiny performance optimization to avoid hitting
the symbol table to find that function on the worker. It has no semantic impact. I'd prefer
to not do it for the examples to keep them simpler.

----------------------------------------------------------------
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: 87342)
    Time Spent: 1h  (was: 50m)

> Add prototype support for Go SDK streaming
> ------------------------------------------
>
>                 Key: BEAM-3856
>                 URL: https://issues.apache.org/jira/browse/BEAM-3856
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Willy Lulciuc
>            Assignee: Henning Rohde
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




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

Mime
View raw message