Skip to content

Commit

Permalink
Add "stopping" state. Fixes issue of load rebalancing and restarting …
Browse files Browse the repository at this point in the history
…when trying to stop a distributed load and slaves rejoin.
  • Loading branch information
Ryan Warner authored and cgoldberg committed Mar 19, 2019
1 parent 68ac9d3 commit 8b17c28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion locust/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .core import HttpLocust, Locust, TaskSet, TaskSequence, task, seq_task
from .exception import InterruptTaskSet, ResponseError, RescheduleTaskImmediately

__version__ = "0.11.0"
__version__ = "0.11.1"
3 changes: 2 additions & 1 deletion locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# global locust runner singleton
locust_runner = None

STATE_INIT, STATE_HATCHING, STATE_RUNNING, STATE_CLEANUP, STATE_STOPPED, STATE_MISSING = ["ready", "hatching", "running", "cleanup", "stopped", "missing"]
STATE_INIT, STATE_HATCHING, STATE_RUNNING, STATE_CLEANUP, STATE_STOPPING, STATE_STOPPED, STATE_MISSING = ["ready", "hatching", "running", "cleanup", "stopping", "stopped", "missing"]
SLAVE_REPORT_INTERVAL = 3.0


Expand Down Expand Up @@ -313,6 +313,7 @@ def start_hatching(self, locust_count, hatch_rate):
self.state = STATE_HATCHING

def stop(self):
self.state = STATE_STOPPING
for client in self.clients.all:
self.server.send_to_client(Message("stop", None, client.id))
events.master_stop_hatching.fire()
Expand Down

1 comment on commit 8b17c28

@SteggyLeggy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really appreciate this code being released on Pypi. 0.11.0 is currently on Pypi and I'm having to kill all of my slave instances and re-spin them up after every test to ensure they won't start testing again. I get the feeling that my slave machines loose connectivity and even after the test has finished (stop_timeout reached) they rejoin and start up again.

I'm having to roll back to 0.9.0 for my next set of tests, as version 0.10.0 doesn't seem to work on my system.

Please sign in to comment.