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


##########
sdks/python/container/run_generate_requirements.sh:
##########
@@ -104,4 +104,16 @@ EOT
 # Remove pkg_resources to guard against
 # 
https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command
 pip freeze | grep -v pkg_resources >> "$REQUIREMENTS_FILE"
+
+# Check if the generated .txt file has the line "tensorflow==".
+if grep -q "tensorflow==" "$REQUIREMENTS_FILE"; then
+
+# Get the version of tensorflow from the .txt file.
+VERSION=$(grep -Po "tensorflow==\K[^;]+" "$REQUIREMENTS_FILE")
+
+# Write the line tensorflow-cpu-aws==${VERSION};platform_machine=="aarch64" to 
the .txt file.
+echo "tensorflow-cpu-aws==${VERSION};platform_machine==\"aarch64\"" >> 
"$REQUIREMENTS_FILE"

Review Comment:
   let's make an indent for `if`.
   



##########
sdks/python/container/run_generate_requirements.sh:
##########
@@ -104,4 +104,16 @@ EOT
 # Remove pkg_resources to guard against
 # 
https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command
 pip freeze | grep -v pkg_resources >> "$REQUIREMENTS_FILE"
+
+# Check if the generated .txt file has the line "tensorflow==".
+if grep -q "tensorflow==" "$REQUIREMENTS_FILE"; then
+
+# Get the version of tensorflow from the .txt file.
+VERSION=$(grep -Po "tensorflow==\K[^;]+" "$REQUIREMENTS_FILE")
+
+# Write the line tensorflow-cpu-aws==${VERSION};platform_machine=="aarch64" to 
the .txt file.
+echo "tensorflow-cpu-aws==${VERSION};platform_machine==\"aarch64\"" >> 
"$REQUIREMENTS_FILE"

Review Comment:
   also suggestion to keep both entries in the same place:
   
   ```
   if grep -q "tensorflow==" "$REQUIREMENTS_FILE"; then
     # Get the version of tensorflow from the .txt file.
     TF_VERSION=$(grep -Po "tensorflow==\K[^;]+" "$REQUIREMENTS_FILE")
     TF_ENTRY="tensorflow==${TF_VERSION}"
     
TF_AARCH64_ENTRY="tensorflow-cpu-aws==${TF_VERSION};platform_machine==\"aarch64\""
     sed -i "s/${TF_ENTRY}/${TF_ENTRY}\n${TF_AARCH64_ENTRY}/g" 
$REQUIREMENTS_FILE
   fi
   ```



##########
sdks/python/container/run_generate_requirements.sh:
##########
@@ -104,4 +104,16 @@ EOT
 # Remove pkg_resources to guard against
 # 
https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command
 pip freeze | grep -v pkg_resources >> "$REQUIREMENTS_FILE"
+
+# Check if the generated .txt file has the line "tensorflow==".
+if grep -q "tensorflow==" "$REQUIREMENTS_FILE"; then
+
+# Get the version of tensorflow from the .txt file.
+VERSION=$(grep -Po "tensorflow==\K[^;]+" "$REQUIREMENTS_FILE")
+
+# Write the line tensorflow-cpu-aws==${VERSION};platform_machine=="aarch64" to 
the .txt file.
+echo "tensorflow-cpu-aws==${VERSION};platform_machine==\"aarch64\"" >> 
"$REQUIREMENTS_FILE"

Review Comment:
   note: this portion can be committed in a separate PR if that's easier, and 
requirements regenerated.



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