gemini-code-assist[bot] commented on code in PR #38781:
URL: https://github.com/apache/beam/pull/38781#discussion_r3346930490
##########
sdks/python/test-suites/dataflow/common.gradle:
##########
@@ -571,7 +571,10 @@ task installTFTRequirements {
exec {
workingDir
"$rootProject.projectDir/sdks/python/apache_beam/testing/benchmarks/cloudml/"
executable 'sh'
- args '-c', ". ${envdir}/bin/activate && pip install -r requirements.txt"
+ args '-c', ". ${envdir}/bin/activate && " +
+ "grep -v '^tensorflow-transform' requirements.txt >
/tmp/cloudml_tft_base_requirements.txt && " +
+ "pip install -r /tmp/cloudml_tft_base_requirements.txt && " +
+ "pip install --no-deps tensorflow-transform==1.16.0"
Review Comment:

Using a hardcoded temporary file path like
`/tmp/cloudml_tft_base_requirements.txt` can lead to conflicts, permission
issues, or race conditions if multiple builds or tasks run concurrently on the
same machine.
It is safer to use `mktemp` to create a unique temporary file and ensure it
is cleaned up after the installation is complete.
```
args '-c', ". ${envdir}/bin/activate && " +
'tmp_file=$(mktemp) && ' +
'grep -v "^tensorflow-transform" requirements.txt > "$tmp_file" &&
' +
'pip install -r "$tmp_file" && ' +
'rm "$tmp_file" && ' +
'pip install --no-deps tensorflow-transform==1.16.0'
```
--
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]