-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add heartbeat to detect down slaves (#927)
* Replace zmq sockets with one DEALER-ROUTER socket The PUSH and PULL sockets being used caused hatch messages to get routed to slaves that may have become unresponsive or crashed. This change includes the client id in the messages sent out from the master which ensures that hatch messages are going to slaves the are READY or RUNNING. This should also fix the issue #911 where slaves are not receiving the stop message. I think these issues are a result of PUSH-PULL sockets using a round robin approach. * Remove client_id parameter from send_multipart method * Add heartbeat worker to server and client The server checks to see if clients have expired and if they have updates their status to "missing". The client has a worker that will send a heartbeat on a regular interval. The heart also relays the slave state back to the master so that they stay in sync. * Use new clients.all property in heartbeat worker * Fix reporting of stopped state Wait until all slaves are reporting in as ready before stating that the master is stopped. * Fix tests after changing ZMQ sockets to DEALER-ROUTER * Change heartbeat log msg to info so that it does not appear in tests * Add tests for zmqrpc.py * Remove commented imports, add note about sleep * Support str/unicode diff in py2 vs py3 * Ensure failed zmqrpc tests clean up bound sockets * Create throw away variable for identity from from ZMQ message I think this looks better than using msg[1]. * Replace usage of parse_options in tests with mock options Using parse_options during test setup can conflict with test runners like pytest. Essentially it will swallow up the options that are meant to be passed to the test runner and instead treats them as options being passed to the test. * Set coverage concurrency to gevent Coverage breaks with gevent and does not fully report green threads as having been tested. Setting concurrency in .coveragerc will fix the issue. https://bitbucket.org/ned/coveragepy/issues/149/coverage-gevent-looks-broken * Add test that shows master heartbeat worker marks slaves missing * Add assertions to test_zmqrpc.py * Use unittest assertions * Change assertion value to bytes object * Add cmdline options for heartbeat liveness and interval * Add new option heartbeat_liveness to test_runners mock options * Ensure SlaveNode class uses heartbeat_liveness default or passed * Ensure hatch data can be updated for slaves currently hatching * Add test for start hatching accepted slave states Checks that start_hatching sends messages to ready, running, and hatching slaves. * Remove unneeded imports of mock
- Loading branch information
Showing
6 changed files
with
176 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[run] | ||
branch = True | ||
source = locust | ||
concurrency = gevent | ||
|
||
[report] | ||
exclude_lines = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.