From 9fe4fb87a6c18a57736d0ff5c1d9a29a3d4418c4 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Wed, 13 Oct 2021 23:54:26 +0000 Subject: [PATCH] Revert "Limit number of concurrent gsutil cp calls" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d3cfea0c78442f0d8e68f8e96d35efceaa782325. Reason for revert: using self.GSUTIL_CP_SEMAPHORE instead of global GSUTIL_CP_SEMAPHORE Original change's description: > Limit number of concurrent gsutil cp calls > > gsutil utilizes as many cores as possible, and will create many threads > too. In combination with gclient doing the same thing (utilize as many > cores as possible), this results in creating way too many processes and > some builders are running out of resources (e.g. can't create threads). > > This limits number of gsutil cp commands in git_cache to two. > > R=​apolito@google.com, dpranke@google.com > > Bug: 1255228, 1249003 > Change-Id: Ifcccaacde6c9e1c60c1da0a0bc5a3e512e158dcc > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3219900 > Reviewed-by: Dirk Pranke > Commit-Queue: Josip Sokcevic Bug: 1255228, 1249003 Change-Id: I0fde2477ea620c683b49efaa2a70262bd8e615e2 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3221900 Bot-Commit: Rubber Stamper Commit-Queue: Josip Sokcevic Reviewed-by: Dirk Pranke --- gclient_scm.py | 6 ++++++ git_cache.py | 11 ++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index d79f07e92..80519d9bb 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -32,6 +32,12 @@ import shutil import subprocess2 +THIS_FILE_PATH = os.path.abspath(__file__) + +GSUTIL_DEFAULT_PATH = os.path.join( + os.path.dirname(os.path.abspath(__file__)), 'gsutil.py') + + class NoUsableRevError(gclient_utils.Error): """Raised if requested revision isn't found in checkout.""" diff --git a/git_cache.py b/git_cache.py index a20662be2..a76816da6 100755 --- a/git_cache.py +++ b/git_cache.py @@ -35,12 +35,6 @@ GC_AUTOPACKLIMIT = 50 GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.' -# gsutil creates many processes and threads. Creating too many gsutil cp -# processes may result in running out of resources, and may perform worse due to -# contextr switching. This limits how many concurrent gsutil cp processes -# git_cache runs. -GSUTIL_CP_SEMAPHORE = threading.Semaphore(2) - try: # pylint: disable=undefined-variable WinErr = WindowsError @@ -312,9 +306,8 @@ class Mirror(object): self.print('Downloading files in %s/* into %s.' % (latest_dir, tempdir)) with self.print_duration_of('download'): - with self.GSUTIL_CP_SEMAPHORE(): - code = gsutil.call('-m', 'cp', '-r', latest_dir + "/*", - tempdir) + code = gsutil.call('-m', 'cp', '-r', latest_dir + "/*", + tempdir) if code: return False # Set HEAD to main.