Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pipeline] Reduce the number of checks for the exist of artifact extension #29594

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def __new__(cls):
with cls._instance_lock:
if cls._instance is None:
cls._instance = object.__new__(cls)
cls.check_artifact_extension()
return cls._instance

def __init__(self, cache_directory=None):
self._cache_directory = cache_directory or self.DEFAULT_DISK_CACHE_DIRECTORY
Path(self._cache_directory).mkdir(exist_ok=True, parents=True)
@staticmethod
def check_artifact_extension():
# check az extension azure-devops installed. Install it if not installed.
process = subprocess.Popen(
"az artifacts --help --yes",
Expand All @@ -63,6 +63,10 @@ def __init__(self, cache_directory=None):
"Auto-installation failed. Please install azure-devops "
"extension by 'az extension add --name azure-devops'."
)

def __init__(self, cache_directory=None):
self._cache_directory = cache_directory or self.DEFAULT_DISK_CACHE_DIRECTORY
Path(self._cache_directory).mkdir(exist_ok=True, parents=True)
self._artifacts_tool_path = None
self._download_locks = defaultdict(Lock)

Expand Down