mirror of
https://github.com/clearml/clearml-agent
synced 2025-01-31 09:06:52 +00:00
Fix git pulling on cached invalid git entry. On error, re-clone the entire repo again (disable using "agent.vcs_cache.clone_on_pull_fail: false")
This commit is contained in:
parent
98cc0d86ba
commit
4179ac5234
@ -777,7 +777,21 @@ def clone_repository_cached(session, execution, destination):
|
|||||||
# We clone the entire repository, not a specific branch
|
# We clone the entire repository, not a specific branch
|
||||||
vcs.clone() # branch=execution.branch)
|
vcs.clone() # branch=execution.branch)
|
||||||
|
|
||||||
|
print("pulling git")
|
||||||
|
try:
|
||||||
vcs.pull()
|
vcs.pull()
|
||||||
|
except Exception as ex:
|
||||||
|
if (
|
||||||
|
session.config.get("agent.vcs_cache.enabled", False) and
|
||||||
|
session.config.get("agent.vcs_cache.clone_on_pull_fail", True)
|
||||||
|
):
|
||||||
|
print("pulling git failed, re-cloning: {}".format(no_password_url))
|
||||||
|
rm_tree(cached_repo_path)
|
||||||
|
vcs.clone()
|
||||||
|
else:
|
||||||
|
raise ex
|
||||||
|
print("pulling git completed")
|
||||||
|
|
||||||
rm_tree(destination)
|
rm_tree(destination)
|
||||||
shutil.copytree(Text(cached_repo_path), Text(clone_folder),
|
shutil.copytree(Text(cached_repo_path), Text(clone_folder),
|
||||||
symlinks=select_for_platform(linux=True, windows=False),
|
symlinks=select_for_platform(linux=True, windows=False),
|
||||||
|
Loading…
Reference in New Issue
Block a user