mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-04-20 14:09:30 +00:00
sync: Warn about excessive job counts
Warn users if the effective job count specified via `-j`, `--jobs-network`, or `--jobs-checkout` exceeds a threshold (currently 100). This encourages users to use more reasonable values. Bug: 406868778 Bug: 254914814 Change-Id: I116e2bbaf3dc824c04d1b2fbe52cf9ca5be77b9a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/466801 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
parent
3667de1d0f
commit
daebd6cbc2
@ -350,6 +350,8 @@ later is required to fix a server side protocol bug.
|
|||||||
# value later on.
|
# value later on.
|
||||||
PARALLEL_JOBS = 0
|
PARALLEL_JOBS = 0
|
||||||
|
|
||||||
|
_JOBS_WARN_THRESHOLD = 100
|
||||||
|
|
||||||
def _Options(self, p, show_smart=True):
|
def _Options(self, p, show_smart=True):
|
||||||
p.add_option(
|
p.add_option(
|
||||||
"--jobs-network",
|
"--jobs-network",
|
||||||
@ -1728,6 +1730,24 @@ later is required to fix a server side protocol bug.
|
|||||||
opt.jobs_network = min(opt.jobs_network, jobs_soft_limit)
|
opt.jobs_network = min(opt.jobs_network, jobs_soft_limit)
|
||||||
opt.jobs_checkout = min(opt.jobs_checkout, jobs_soft_limit)
|
opt.jobs_checkout = min(opt.jobs_checkout, jobs_soft_limit)
|
||||||
|
|
||||||
|
# Warn once if effective job counts seem excessively high.
|
||||||
|
# Prioritize --jobs, then --jobs-network, then --jobs-checkout.
|
||||||
|
job_options_to_check = (
|
||||||
|
("--jobs", opt.jobs),
|
||||||
|
("--jobs-network", opt.jobs_network),
|
||||||
|
("--jobs-checkout", opt.jobs_checkout),
|
||||||
|
)
|
||||||
|
for name, value in job_options_to_check:
|
||||||
|
if value > self._JOBS_WARN_THRESHOLD:
|
||||||
|
logger.warning(
|
||||||
|
"High job count (%d > %d) specified for %s; this may "
|
||||||
|
"lead to excessive resource usage or diminishing returns.",
|
||||||
|
value,
|
||||||
|
self._JOBS_WARN_THRESHOLD,
|
||||||
|
name,
|
||||||
|
)
|
||||||
|
break
|
||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user