clearml-agent
clearml-agent copied to clipboard
Issue cloning repo containing symlink
Hello clearml team,
I ran into some troubles trying to run code from a repository containing versioned symlink.
Context
the master contains a symlink to a local folder. the commit I want to execute has deleted this symlink.
Issue :
clearml-agent (1.1.0) can't checkout the commit, complaining that the symlink will be overwritten "error: Your local changes to the following files would be overwritten by checkout:"
Investigation
I took a look on how clearml-agent clone/checkout the repository of the experiment :
https://github.com/allegroai/clearml-agent/blob/2cb452b1c21191f17635bcb6222fa8bfd82afe29/clearml_agent/helper/repo.py#L654-L672
Clearml first clone/checkout the master of the repository, then it copies the repo and finally checkout the requested commit in the copy.
The issue occurs during the copy were symlinks are lost (replaced by hard copy). Then git complains that the non versioned hard copy of the symlink will be deleted by the checkout.
Proposed fix
using
shutil.copytree(Text(cached_repo_path), Text(clone_folder), symlinks=True)
instead of
shutil.copytree(Text(cached_repo_path), Text(clone_folder))
solved my issue.
Do you think it is possible to include this modification in your next version or there might be some regressions I can't think of ?
Thanks for your time !
Hi @elinep,
Sure, did you manage to verify your proposed fix by any chance?
Yes I did check that modifying the shutil.copytree() allowed me to run my experiment properly. Do you want me to create a git repository that reproduce the problem ?
Hi @elinep ,
Do you want me to create a git repository that reproduce the problem ?
No, it's fine, just wanted to make sure it's working for you 🙂
Closing this as this was already released. Please reopen if required.