Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prism] support single external env pipelines. #28083

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions sdks/go/pkg/beam/runners/prism/internal/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func RunPipeline(j *jobservices.Job) {
// environments, and start up docker containers, but
// here, we only want and need the go one, operating
// in loopback mode.
env := "go"
envs := j.Pipeline.GetComponents().GetEnvironments()
env, _ := getOnlyPair(envs)
lostluck marked this conversation as resolved.
Show resolved Hide resolved
wk := worker.New(env) // Cheating by having the worker id match the environment id.
go wk.Serve()

Expand Down Expand Up @@ -302,12 +303,17 @@ func getWindowValueCoders(comps *pipepb.Components, col *pipepb.PCollection, cod
return makeWindowCoders(coders[wcID])
}

func getOnlyValue[K comparable, V any](in map[K]V) V {
func getOnlyPair[K comparable, V any](in map[K]V) (K, V) {
if len(in) != 1 {
panic(fmt.Sprintf("expected single value map, had %v - %v", len(in), in))
}
for _, v := range in {
return v
for k, v := range in {
return k, v
}
panic("unreachable")
}

func getOnlyValue[K comparable, V any](in map[K]V) V {
_, v := getOnlyPair(in)
return v
}