You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/07/01 22:15:52 UTC
[GitHub] [beam] tvalentyn commented on a change in pull request #12115: [BEAM-7672] dynamically setup acceptable wheel specs according to installed python version
tvalentyn commented on a change in pull request #12115:
URL: https://github.com/apache/beam/pull/12115#discussion_r448642475
##########
File path: sdks/python/container/boot.go
##########
@@ -170,6 +176,28 @@ func main() {
log.Fatalf("Python exited: %v", execx.Execute("python", args...))
}
+// setup wheel specs according to installed python version
+func setupAcceptableWheelSpecs() error {
+ cmd := exec.Command("python", "-V")
+ stdoutStderr, err := cmd.CombinedOutput()
+ if err != nil {
+ return err
+ }
+ re := regexp.MustCompile(`Python (\d)\.(\d).*`)
+ pyVersions := re.FindStringSubmatch(string(stdoutStderr[:]))
+ if len(pyVersions) != 3 {
+ return fmt.Errorf("cannot get python version with expected format")
Review comment:
How about we say "Cannot get parse Python version from ..." and append the output?
##########
File path: sdks/python/container/boot.go
##########
@@ -127,6 +129,10 @@ func main() {
// Guard from concurrent artifact retrieval and installation,
// when called by child processes in a worker pool.
+ if err := setupAcceptableWheelSpecs(); err != nil {
+ log.Fatalf("Failed to setup acceptable wheel specs: %v", err)
Review comment:
I think we should not fail but leave acceptableWhlSpecs as empty in this case.
----------------------------------------------------------------
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:
users@infra.apache.org