mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-24 21:24:36 +00:00
Add git clone verbosity using CLEARML_AGENT_GIT_CLONE_VERBOSE
env var
This commit is contained in:
parent
55b065a114
commit
7c3e420df4
@ -244,6 +244,8 @@ ENV_PACKAGE_PYTORCH_RESOLVE = EnvironmentConfig("CLEARML_AGENT_PACKAGE_PYTORCH_R
|
|||||||
|
|
||||||
ENV_TEMP_STDOUT_FILE_DIR = EnvironmentConfig("CLEARML_AGENT_TEMP_STDOUT_FILE_DIR")
|
ENV_TEMP_STDOUT_FILE_DIR = EnvironmentConfig("CLEARML_AGENT_TEMP_STDOUT_FILE_DIR")
|
||||||
|
|
||||||
|
ENV_GIT_CLONE_VERBOSE = EnvironmentConfig("CLEARML_AGENT_GIT_CLONE_VERBOSE", type=bool)
|
||||||
|
|
||||||
|
|
||||||
class FileBuffering(IntEnum):
|
class FileBuffering(IntEnum):
|
||||||
"""
|
"""
|
||||||
|
@ -19,7 +19,7 @@ from pathlib2 import Path
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from clearml_agent.definitions import ENV_AGENT_GIT_USER, ENV_AGENT_GIT_PASS, ENV_AGENT_GIT_HOST
|
from clearml_agent.definitions import ENV_AGENT_GIT_USER, ENV_AGENT_GIT_PASS, ENV_AGENT_GIT_HOST, ENV_GIT_CLONE_VERBOSE
|
||||||
from clearml_agent.helper.console import ensure_text, ensure_binary
|
from clearml_agent.helper.console import ensure_text, ensure_binary
|
||||||
from clearml_agent.errors import CommandFailedError
|
from clearml_agent.errors import CommandFailedError
|
||||||
from clearml_agent.helper.base import (
|
from clearml_agent.helper.base import (
|
||||||
@ -197,8 +197,9 @@ class VCS(object):
|
|||||||
self.log.info("successfully applied uncommitted changes")
|
self.log.info("successfully applied uncommitted changes")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Command-line flags for clone command
|
def clone_flags(self):
|
||||||
clone_flags = ()
|
"""Command-line flags for clone command"""
|
||||||
|
return tuple()
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def executable_not_found_error_help(self):
|
def executable_not_found_error_help(self):
|
||||||
@ -366,7 +367,7 @@ class VCS(object):
|
|||||||
self._set_ssh_url()
|
self._set_ssh_url()
|
||||||
# if we are on linux no need for the full auth url because we use GIT_ASKPASS
|
# if we are on linux no need for the full auth url because we use GIT_ASKPASS
|
||||||
url = self.url_without_auth if self._use_ask_pass else self.url_with_auth
|
url = self.url_without_auth if self._use_ask_pass else self.url_with_auth
|
||||||
clone_command = ("clone", url, self.location) + self.clone_flags
|
clone_command = ("clone", url, self.location) + self.clone_flags()
|
||||||
# clone all branches regardless of when we want to later checkout
|
# clone all branches regardless of when we want to later checkout
|
||||||
# if branch:
|
# if branch:
|
||||||
# clone_command += ("-b", branch)
|
# clone_command += ("-b", branch)
|
||||||
@ -543,7 +544,6 @@ class VCS(object):
|
|||||||
class Git(VCS):
|
class Git(VCS):
|
||||||
executable_name = "git"
|
executable_name = "git"
|
||||||
main_branch = ("master", "main")
|
main_branch = ("master", "main")
|
||||||
clone_flags = ("--quiet", "--recursive")
|
|
||||||
checkout_flags = ("--force",)
|
checkout_flags = ("--force",)
|
||||||
COMMAND_ENV = {
|
COMMAND_ENV = {
|
||||||
# do not prompt for password
|
# do not prompt for password
|
||||||
@ -569,6 +569,12 @@ class Git(VCS):
|
|||||||
"origin/{}".format(b) for b in ([branch] if isinstance(branch, str) else branch)
|
"origin/{}".format(b) for b in ([branch] if isinstance(branch, str) else branch)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def clone_flags(self):
|
||||||
|
return (
|
||||||
|
"--recursive",
|
||||||
|
"--verbose" if ENV_GIT_CLONE_VERBOSE.get() else "--quiet"
|
||||||
|
)
|
||||||
|
|
||||||
def executable_not_found_error_help(self):
|
def executable_not_found_error_help(self):
|
||||||
return 'Cannot find "{}" executable. {}'.format(
|
return 'Cannot find "{}" executable. {}'.format(
|
||||||
self.executable_name,
|
self.executable_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user