Skip to content

Commit 190898c

Browse files
authored
Avoid cloning live dev venv for yaml expansion in CI (#38063)
1 parent 60723cd commit 190898c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sdks/python/apache_beam/yaml/yaml_provider.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,13 @@ def _create_venv_from_clone(
14121412

14131413
@classmethod
14141414
def _create_venv_to_clone(cls, base_python: str) -> str:
1415-
if '.dev' in beam_version:
1415+
# For '.dev', the default clone source is the venv that owns base_python.
1416+
# In CI that is often the active tox/sandbox tree; clonevirtualenv can
1417+
# race with ephemeral paths (tmp/, caches) under that tree. Use the
1418+
# scratch clonable venv in CI instead. Locally, keep cloning the dev venv
1419+
# for speed.
1420+
_ci = os.environ.get('CI', '').lower() in ('true', '1', 'yes')
1421+
if '.dev' in beam_version and not _ci:
14161422
base_venv = os.path.dirname(os.path.dirname(base_python))
14171423
print('Cloning dev environment from', base_venv)
14181424
return base_venv

0 commit comments

Comments
 (0)