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

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

                Author: ASF GitHub Bot
            Created on: 14/May/20 15:26
            Start Date: 14/May/20 15:26
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #11665:
URL: https://github.com/apache/beam/pull/11665#discussion_r424803035



##########
File path: sdks/go/pkg/beam/io/synthetic/source.go
##########
@@ -33,22 +33,30 @@ import (
 // generated KV<[]byte, []byte> elements.
 //
 // This transform accepts a PCollection of SourceConfig, where each 
SourceConfig
-// determines the synthetic source's behavior for that element.
+// determines the synthetic source's behavior for that element and outputs the
+// randomly generated elements.
 //
-// This transform outputs a PCollection of randomly generated
-// KV<byte[], byte[]> elements.
+// SourceConfigs are recommended to be created via the DefaultSourceConfig and
+// then sent to a beam.Create transform once modified. Example:
+//
+//    cfg1 := synthetic.DefaultSourceConfig()
+//    cfg1.NumElements = 1000
+//    cfg2 := synthetic.DefaultSourceConfig()

Review comment:
       Given the verbosity, it's likely users will end up writing this as.
   
   ```
   //    cfgs := beam.CreateList(s, 
[]synthetic.SourceConfig{{NumElements:1000}, {NumElements:5000: 
InitialSplits:2}})
   //    src := synthetic.Source(s, cfgs)
   ```
   
   But ones that enjoy breaking code might run into breaks when we add fields 
with:
   ```
    cfgs := beam.CreateList(s, []synthetic.SourceConfig{{1000, 1}, {5000,2}})
    src := synthetic.Source(s, cfgs)
   ```
   ... which is why one should always name one's fields when using struct 
literals.

##########
File path: sdks/go/pkg/beam/io/synthetic/source.go
##########
@@ -0,0 +1,151 @@
+// 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.
+
+// Package synthetic contains transforms for creating synthetic pipelines.
+// Synthetic pipelines are pipelines that simulate the behavior of possible
+// pipelines in order to test performance, splitting, liquid sharding, and
+// various other infrastructure used for running pipelines. This category of
+// tests are not concerned with the correctness of the elements themselves, but
+// need to simulate transforms that output many elements throughout varying
+// pipeline shapes.
+package synthetic
+
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/io/rtrackers/offsetrange"
+       "math/rand"
+       "time"
+)
+
+// Source creates a synthetic source transform that emits randomly
+// generated KV<[]byte, []byte> elements.
+//
+// This transform accepts a PCollection of SourceConfig, where each 
SourceConfig
+// determines the synthetic source's behavior for that element.

Review comment:
       output_records_per_input_record is problematic, but doesn't apply to 
SourceConfig I would think... (SrcCfg?) That seems like a perDoFn configuration.
   
   Unless that's the "NumElements" you were mentioning?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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: 433183)
    Time Spent: 0.5h  (was: 20m)

> Create Go SDK synthetic sources.
> --------------------------------
>
>                 Key: BEAM-9951
>                 URL: https://issues.apache.org/jira/browse/BEAM-9951
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Daniel Oliveira
>            Assignee: Daniel Oliveira
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Create synthetic sources for the Go SDK like 
> [Java|https://github.com/apache/beam/tree/master/sdks/java/io/synthetic/src/main/java/org/apache/beam/sdk/io/synthetic]
>  and 
> [Python|https://github.com/apache/beam/blob/master/sdks/python/apache_beam/testing/synthetic_pipeline.py]
>  have.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to