From 355f4398d870573255574c895f808485310b5c10 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 20 Jul 2022 17:15:29 -0400 Subject: sync: rework --jobs to provide better defaults For --jobs-network, the logic is now: * If the user specifies --jobs-network, use that. * Else, if the user specifies --jobs, use that. * Else, if the manifest specifies sync-j, use that. * Else, default to 1. Then we limit the jobs count based on the softlimit RLIMIT_NOFILE. For --jobs-checkout, the logic is now: * If the user specifies --jobs-checkout, use that. * Else, if the user specifies --jobs, use that. * Else, if the manifest specifies sync-j, use that. * Else, default to DEFAULT_LOCAL_JOBS which is based on user's ncpus. Then we limit the jobs count based on the softlimit RLIMIT_NOFILE. For garbage collecting, the logic is now: * If the user specifies --jobs, use that. * Else, if the manifest specifies sync-j, use that. * Else, default to the user's ncpus. Then we limit the jobs count based on the softlimit RLIMIT_NOFILE. Having to factor in the manifest settings makes this more complicated which is why we delay processing of defaults until after we've synced the manifest projects. Bug: http://b/239712300 Change-Id: Id27cda63c76c156f1d63f6a20cb2c4ceeb3d547c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/341394 Tested-by: Mike Frysinger Reviewed-by: LaMont Jones --- manifest_xml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 12614c64..ee513a7e 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -123,7 +123,7 @@ class _Default(object): destBranchExpr = None upstreamExpr = None remote = None - sync_j = 1 + sync_j = None sync_c = False sync_s = False sync_tags = True @@ -548,7 +548,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md if d.upstreamExpr: have_default = True e.setAttribute('upstream', d.upstreamExpr) - if d.sync_j > 1: + if d.sync_j is not None: have_default = True e.setAttribute('sync-j', '%d' % d.sync_j) if d.sync_c: @@ -1462,8 +1462,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md d.destBranchExpr = node.getAttribute('dest-branch') or None d.upstreamExpr = node.getAttribute('upstream') or None - d.sync_j = XmlInt(node, 'sync-j', 1) - if d.sync_j <= 0: + d.sync_j = XmlInt(node, 'sync-j', None) + if d.sync_j is not None and d.sync_j <= 0: raise ManifestParseError('%s: sync-j must be greater than 0, not "%s"' % (self.manifestFile, d.sync_j)) -- cgit v1.2.3-54-g00ecf