[
https://issues.apache.org/jira/browse/BEAM-13024?focusedWorklogId=720390&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-720390
]
ASF GitHub Bot logged work on BEAM-13024:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Feb/22 20:25
Start Date: 03/Feb/22 20:25
Worklog Time Spent: 10m
Work Description: lostluck commented on a change in pull request #16719:
URL: https://github.com/apache/beam/pull/16719#discussion_r798933097
##########
File path: sdks/go/pkg/beam/core/runtime/options.go
##########
@@ -117,6 +118,23 @@ func (o *Options) Export() RawOptions {
return RawOptions{Options: copyMap(o.opt)}
}
+// LoadOptionsFromFlags adds any flags not defined in excludeFlags to the
options.
+// If the key is already defnined, it panics.
Review comment:
```suggestion
// If the key is already defined, it panics.
```
##########
File path: sdks/go/pkg/beam/runners/direct/direct.go
##########
@@ -65,6 +65,7 @@ func Execute(ctx context.Context, p *beam.Pipeline)
(beam.PipelineResult, error)
if err != nil {
return nil, errors.Wrap(err, "translation failed")
}
+ beam.PipelineOptions.LoadOptionsFromFlags(make(map[string]bool))
Review comment:
I just checked the go playground and at least at 1.17 it seems like
lookups in nil maps do not panic (they just return the default value for the
type). Prefer just passing in a nil instead, and if uncomfortable relying on
the default behavior, initializing it in the function instead.
Insertions to nil maps *do* panic though.
https://go.dev/play/p/H7QiTyKeAyU
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 720390)
Time Spent: 50m (was: 40m)
> [Go SDK] Export flags to PipelineOptions on non-dataflow runners.
> -----------------------------------------------------------------
>
> Key: BEAM-13024
> URL: https://issues.apache.org/jira/browse/BEAM-13024
> Project: Beam
> Issue Type: Bug
> Components: sdk-go
> Reporter: Robert Burke
> Assignee: Danny McCormick
> Priority: P2
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Recently the Go SDK dataflow runner code began adding explicitly set flags to
> the pipeline options. This made them available to worker code at execution
> time, if queried with `beam.PipelineOptions.Get`.
> The proposal is to generalize this code and make use of it in all runners
> (including the direct runner). This would make PipelineOptions a useful
> concept in the Go SDK.
> Flag filtering and adding here:
>
> [https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/runners/dataflow/dataflow.go#L281]
> Once implemented for all runners, it should be possible to test use of this
> in the integration tests to ensure continued function.
> Danny wrote a quick Doc:
> https://docs.google.com/document/d/1AyO5SDEd_DzyOyrz_TkyDLUv19eLsKI97vKM8I7fQ9o/edit#
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)