zuul/tests/unit
James E. Blair df37ad2ce7 Executor: Don't start too many jobs at once
The metrics that we use to govern load on the executors are all
trailing indicators.  The executors are capable of accepting a
large number of jobs in a batch and then, only after they begin
to run, will the load indicators increase.  To avoid the thundering
herd problem, reduce the rate at which we accept jobs past a certain
point.

That point is twice the number of jobs as the target load average.
In practice that seems to be a fairly conservative but reasonable
number of jobs for the executor to run, so, to facilitate a quick
start, allow the executor to start up to that number all at once.

Once the number of jobs running is beyond that number, subsequent
jobs will only be accepted one at a time, after each one completes
its startup phase (cloning repos, establishing ansible connections),
which is to say, at the point where the job begins running its first
pre-playbook.

We will also wait until the next regular interval of the governor
to accept the next job.  That's currently 30 seconds, but to make
the system a bit more responsive, it's lowered to 10 seconds in this
change.

To summarize: after a bunch[1] of jobs are running, after each new
job, we wait until that job has started running playbooks, plus up
to an additional 10 seconds, before accepting a new job.

This is implemented by adding a 'starting jobs' metric to the governor
so that we register or de-register the execute function based on
whether too many jobs are in the startup phase.  We add a forced
call to the governor routine after each job starts so that we can
unregister if necessary before picking up the next job, and wrap that
routine in a lock since it is now called from multiple threads and
its logic may not be entirely thread-safe.

Also, add tests for all three inputs to manageLoad.

[1] 2*target load average

Change-Id: I066bc539e70eb475ca2b871fb90644264d8d5bf4
2018-02-02 11:36:49 -08:00
..
__init__.py Move tests into test/unit 2017-01-24 10:18:38 -08:00
test_bubblewrap.py Write secrets to tmpfs 2017-08-19 08:08:19 -07:00
test_change_matcher.py Fix branch matching logic 2017-10-02 17:30:51 -04:00
test_clonemapper.py Tests: store debug logs on error 2017-02-06 10:10:48 -08:00
test_cloner_cmd.py Replace equals None with is None 2017-06-05 13:06:10 -05:00
test_configloader.py change assert(Not)Equals to assert(Not)Equal 2017-09-13 17:34:24 -06:00
test_connection.py Merge "Really change patchset column to string" into feature/zuulv3 2018-01-16 23:05:19 +00:00
test_cross_crd.py Add cross-source tests 2018-01-16 09:37:59 -08:00
test_daemon.py Move tests into test/unit 2017-01-24 10:18:38 -08:00
test_disk_accountant.py Improve cleanup of test disk accountant 2017-08-01 07:51:23 +02:00
test_encryption.py Encoding changes in tests for py3 2017-05-19 06:45:31 -07:00
test_executor.py Executor: Don't start too many jobs at once 2018-02-02 11:36:49 -08:00
test_gerrit.py change assert(Not)Equals to assert(Not)Equal 2017-09-13 17:34:24 -06:00
test_gerrit_crd.py Fix dependency cycle false positive 2018-01-17 04:23:39 +00:00
test_gerrit_legacy_crd.py Fix dependency cycle false positive 2018-01-17 04:23:39 +00:00
test_git_driver.py Stabilize git driver tests 2018-01-17 09:53:18 -08:00
test_github_crd.py Implement Depends-On for github 2017-06-29 11:26:19 -07:00
test_github_driver.py Merge "Use hotlink instead log url in github job report" into feature/zuulv3 2018-01-16 23:53:14 +00:00
test_github_requirements.py Remove unnecessary loop in github test 2017-07-06 15:59:03 -07:00
test_inventory.py Add specific setup inventory 2017-12-28 18:13:44 +01:00
test_merger_repo.py Add git timeout 2017-10-10 08:10:20 -07:00
test_model.py Don't override allowed-projects 2018-01-26 14:28:46 -08:00
test_multi_driver.py Remove status handling from FakeGithubConnection 2017-08-03 19:22:54 +00:00
test_nodepool.py Add support for shared ansible_host in inventory 2017-11-18 16:22:01 -05:00
test_openstack.py Use correct label casing in tests 2017-07-27 07:50:03 +02:00
test_push_reqs.py Ensure ref-updated jobs run with their ref 2017-08-02 16:56:18 -07:00
test_requirements.py Use correct label casing in tests 2017-07-27 07:50:03 +02:00
test_scheduler.py Prune stale branches from mergers 2018-01-23 09:43:26 -08:00
test_ssh_agent.py Add SSH Agent Primitives and usage 2017-05-26 09:52:22 -07:00
test_stack_dump.py Several executor threading fixes 2017-10-17 09:49:29 -07:00
test_streaming.py Remove need to start executor as root 2018-01-10 13:57:16 -05:00
test_v3.py Don't override allowed-projects 2018-01-26 14:28:46 -08:00
test_web.py Add zuul-web tests equivalent to the webapp tests 2017-12-21 09:59:23 -08:00
test_webapp.py Return 404 on unknown tenants 2017-08-17 09:54:08 -07:00
test_zuultrigger.py Support cross-source dependencies 2018-01-16 09:37:40 -08:00