clearml-agent icon indicating copy to clipboard operation
clearml-agent copied to clipboard

Issue cloning repo containing symlink

Open elinep opened this issue 3 years ago • 3 comments

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 !

elinep avatar Jan 07 '22 10:01 elinep

Hi @elinep,

Sure, did you manage to verify your proposed fix by any chance?

jkhenning avatar Jan 09 '22 08:01 jkhenning

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 ?

elinep avatar Jan 09 '22 17:01 elinep

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 🙂

jkhenning avatar Jan 09 '22 18:01 jkhenning

Closing this as this was already released. Please reopen if required.

jkhenning avatar Mar 15 '23 13:03 jkhenning