tvalentyn commented on code in PR #16658:
URL: https://github.com/apache/beam/pull/16658#discussion_r846529441


##########
sdks/python/container/boot.go:
##########
@@ -137,46 +145,49 @@ func main() {
 
        options, err := provision.ProtoToJSON(info.GetPipelineOptions())
        if err != nil {
-               log.Fatalf("Failed to convert pipeline options: %v", err)
+               return fmt.Errorf("Failed to convert pipeline options: %v", err)
        }
 
        // (2) Retrieve and install the staged packages.
        //
-       // Guard from concurrent artifact retrieval and installation,
-       // when called by child processes in a worker pool.
+       // No log.Fatalf() from here on, otherwise deferred cleanups will not 
be called!
 
-       materializeArtifactsFunc := func() {
-               dir := filepath.Join(*semiPersistDir, "staged")
+       // Trap signals, so we can clean up properly.
+       signalChannel := make(chan os.Signal, 1)
+       signal.Notify(signalChannel, syscall.SIGHUP, syscall.SIGINT, 
syscall.SIGTERM)
 
-               files, err := artifact.Materialize(ctx, *artifactEndpoint, 
info.GetDependencies(), info.GetRetrievalToken(), dir)
-               if err != nil {
-                       log.Fatalf("Failed to retrieve staged files: %v", err)
-               }
+       venvDir, err := setupVenv(filepath.Join(*semiPersistDir, "beam-venv"), 
*id)
+       if err != nil {
+               return fmt.Errorf("Failed to initialize Python venv.")
+       }
+       cleanupFunc := func() {
+               log.Printf("Cleaning up temporary venv ...")

Review Comment:
   nit: also for messages ending with ... such as `doing <action> ...`, there 
may be an expectation of  an `<action> completed` message. Let's remove the 
ellipsis or add a 'completed' counterpart per your choice.



-- 
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]

Reply via email to