Skip to content

Commit 184a768

Browse files
andrewjcgfacebook-github-bot
authored andcommitted
Resolve top-level symlinks when configuring conda code sync (#909)
Summary: When configuring the conda env as a workspace, resolve any top-level symlinks before handing off to the sync tool (so that it doesn't copy the symlink itself). Reviewed By: highker Differential Revision: D80467880
1 parent 7eda531 commit 184a768

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/monarch/_src/actor/proc_mesh.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,15 @@ async def sync_workspace(
413413
# If `conda` is set, also sync the currently activated conda env.
414414
conda_prefix = conda_utils.active_env_dir()
415415
if conda and conda_prefix is not None:
416+
conda_prefix = Path(conda_prefix)
417+
418+
# Resolve top-level symlinks for rsync/conda-sync.
419+
while conda_prefix.is_symlink():
420+
conda_prefix = conda_prefix.parent / conda_prefix.readlink()
421+
416422
workspaces.append(
417423
WorkspaceConfig(
418-
local=Path(conda_prefix),
424+
local=conda_prefix,
419425
remote=RemoteWorkspace(
420426
location=WorkspaceLocation.FromEnvVar("CONDA_PREFIX"),
421427
shape=WorkspaceShape.shared("gpus"),

0 commit comments

Comments
 (0)