[ https://issues.apache.org/jira/browse/BEAM-7980?focusedWorklogId=299574&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-299574 ]
ASF GitHub Bot logged work on BEAM-7980: ---------------------------------------- Author: ASF GitHub Bot Created on: 22/Aug/19 16:59 Start Date: 22/Aug/19 16:59 Worklog Time Spent: 10m Work Description: aaltay commented on pull request #9398: [BEAM-7980] Exactly once artifact retrieval for Python SDK worker pool URL: https://github.com/apache/beam/pull/9398#discussion_r316782950 ########## File path: sdks/python/container/boot.go ########## @@ -105,18 +107,57 @@ func main() { // (2) Retrieve and install the staged packages. - dir := filepath.Join(*semiPersistDir, "staged") + func() { - files, err := artifact.Materialize(ctx, *artifactEndpoint, info.GetRetrievalToken(), dir) - if err != nil { - log.Fatalf("Failed to retrieve staged files: %v", err) - } + installCompleteFile := filepath.Join(os.TempDir(), "beam.install.complete") - // TODO(herohde): the packages to install should be specified explicitly. It - // would also be possible to install the SDK in the Dockerfile. - if setupErr := installSetupPackages(files, dir); setupErr != nil { - log.Fatalf("Failed to install required packages: %v", setupErr) - } + // skip if install already complete + _, err = os.Stat(installCompleteFile) + if err == nil { + return + } + + // lock to guard from concurrent artifact retrieval and installation, + // when called by child processes in a worker pool + lock, err := lockfile.New(filepath.Join(os.TempDir(), "beam.install.lck")) Review comment: Should we separate `filepath.Join(os.TempDir(), "beam.install.lck")` to a variable similar to `installCompleteFile`? Not sure what is the go convention if it is being used only in one place. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 299574) Time Spent: 6h (was: 5h 50m) > External environment with containerized worker pool > --------------------------------------------------- > > Key: BEAM-7980 > URL: https://issues.apache.org/jira/browse/BEAM-7980 > Project: Beam > Issue Type: Improvement > Components: sdk-py-harness > Reporter: Thomas Weise > Assignee: Thomas Weise > Priority: Major > Time Spent: 6h > Remaining Estimate: 0h > > Augment Beam Python docker image and boot.go so that it can be used to launch > BeamFnExternalWorkerPoolServicer. > [https://docs.google.com/document/d/1z3LNrRtr8kkiFHonZ5JJM_L4NWNBBNcqRc_yAf6G0VI/edit#heading=h.lnhm75dhvhi0] > -- This message was sent by Atlassian Jira (v8.3.2#803003)