diff options
author | Mike Frysinger <vapier@google.com> | 2022-07-20 17:15:29 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2022-07-25 15:36:43 +0000 |
commit | 355f4398d870573255574c895f808485310b5c10 (patch) | |
tree | dcdf96fd22bed67ac5fdf57644d7ad6e7b2a4865 /manifest_xml.py | |
parent | bddc964d9340c66066590a81d21934362fb0c490 (diff) | |
download | git-repo-355f4398d870573255574c895f808485310b5c10.tar.gz |
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 <vapier@google.com>
Reviewed-by: LaMont Jones <lamontjones@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 8 |
1 files changed, 4 insertions, 4 deletions
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): | |||
123 | destBranchExpr = None | 123 | destBranchExpr = None |
124 | upstreamExpr = None | 124 | upstreamExpr = None |
125 | remote = None | 125 | remote = None |
126 | sync_j = 1 | 126 | sync_j = None |
127 | sync_c = False | 127 | sync_c = False |
128 | sync_s = False | 128 | sync_s = False |
129 | sync_tags = True | 129 | sync_tags = True |
@@ -548,7 +548,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
548 | if d.upstreamExpr: | 548 | if d.upstreamExpr: |
549 | have_default = True | 549 | have_default = True |
550 | e.setAttribute('upstream', d.upstreamExpr) | 550 | e.setAttribute('upstream', d.upstreamExpr) |
551 | if d.sync_j > 1: | 551 | if d.sync_j is not None: |
552 | have_default = True | 552 | have_default = True |
553 | e.setAttribute('sync-j', '%d' % d.sync_j) | 553 | e.setAttribute('sync-j', '%d' % d.sync_j) |
554 | if d.sync_c: | 554 | if d.sync_c: |
@@ -1462,8 +1462,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
1462 | d.destBranchExpr = node.getAttribute('dest-branch') or None | 1462 | d.destBranchExpr = node.getAttribute('dest-branch') or None |
1463 | d.upstreamExpr = node.getAttribute('upstream') or None | 1463 | d.upstreamExpr = node.getAttribute('upstream') or None |
1464 | 1464 | ||
1465 | d.sync_j = XmlInt(node, 'sync-j', 1) | 1465 | d.sync_j = XmlInt(node, 'sync-j', None) |
1466 | if d.sync_j <= 0: | 1466 | if d.sync_j is not None and d.sync_j <= 0: |
1467 | raise ManifestParseError('%s: sync-j must be greater than 0, not "%s"' % | 1467 | raise ManifestParseError('%s: sync-j must be greater than 0, not "%s"' % |
1468 | (self.manifestFile, d.sync_j)) | 1468 | (self.manifestFile, d.sync_j)) |
1469 | 1469 | ||