lostluck commented on a change in pull request #16833:
URL: https://github.com/apache/beam/pull/16833#discussion_r805028667
##########
File path: sdks/go/container/boot.go
##########
@@ -99,60 +87,87 @@ func main() {
log.Fatalf("Failed to retrieve staged files: %v", err)
}
- // TODO(BEAM-13647): Remove legacy hack once aged out.
+ name, err := getGoWorkerArtifactName(artifacts)
+ if err != nil {
+ log.Fatalf("Failed to get Go Worker Artifact Name: %v", err)
+ }
+
+ // (3) The persist dir may be on a noexec volume, so we must
+ // copy the binary to a different location to execute.
+ const prog = "/bin/worker"
+ if err := copyExe(filepath.Join(dir, name), prog); err != nil {
+ log.Fatalf("Failed to copy worker binary: %v", err)
+ }
+
+ args := []string{
+ "--worker=true",
+ "--id=" + *id,
+ "--logging_endpoint=" + *loggingEndpoint,
+ "--control_endpoint=" + *controlEndpoint,
+ "--semi_persist_dir=" + *semiPersistDir,
+ "--options=" + options,
+ }
+ if info.GetStatusEndpoint() != nil {
+ args = append(args,
"--status_endpoint="+info.GetStatusEndpoint().GetUrl())
+ }
+
+ log.Fatalf("User program exited: %v", execx.Execute(prog, args...))
+}
+
+func getGoWorkerArtifactName(artifacts []*pipepb.ArtifactInformation) (string,
error) {
const worker = "worker"
name := worker
switch len(artifacts) {
case 0:
- log.Fatal("No artifacts staged")
+ return "", errors.New(fmt.Sprintf("No artifacts staged"))
case 1:
name, _ = artifact.MustExtractFilePayload(artifacts[0])
+ return name, nil
Review comment:
Right now the bootloader for Go is in a transitional state, and supports
the old mechanism (which functionally assumes there's either artifact that must
be the worker, or that something has the default worker name). While in
principle we should be able to fully migrate now for the 2.38 release, I'd like
to wait until after the 2.38 cut and fully migrate for the 2.39 release
instead, because I'm paranoid.
--
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]