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

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

                Author: ASF GitHub Bot
            Created on: 15/Feb/22 18:37
            Start Date: 15/Feb/22 18:37
    Worklog Time Spent: 10m 
      Work Description: 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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 727286)
    Time Spent: 1h 40m  (was: 1.5h)

> Add unit testing to the Go container bootloader package
> -------------------------------------------------------
>
>                 Key: BEAM-13922
>                 URL: https://issues.apache.org/jira/browse/BEAM-13922
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Robert Burke
>            Assignee: Danny McCormick
>            Priority: P2
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Add unit testing to the container bootloader package for Go.
> https://github.com/apache/beam/tree/master/sdks/go/container is undertested,
> We want to have code coverage at or above 50%, it is currently at 0%.
> This will require refactoring main to be more testable.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to