Skip to content

Commit

Permalink
Address some of the comments from PR locustio#1809
Browse files Browse the repository at this point in the history
  • Loading branch information
mboutet committed Jul 28, 2021
1 parent 4576185 commit 01162ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion locust/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def _ramp_down(self) -> Dict[str, Dict[str, int]]:
if self._current_user_count == 0 or self._current_user_count <= current_user_count_target:
return self._users_on_workers

# TODO: Test this
def _distribute_users(
self, target_user_count: int
) -> Tuple[dict, Generator[str, None, None], typing.Iterator["WorkerNode"], List[Tuple["WorkerNode", str]]]:
Expand Down
10 changes: 2 additions & 8 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def start(self, user_count: int, spawn_rate: float, wait: bool = False):
worker_nodes=[self._local_worker_node], user_classes=self.user_classes
)

logger.info("Ramping to %d users using a %.2f spawn rate" % (user_count, spawn_rate))
logger.info("Ramping to %d users at a rate of %g per second" % (user_count, spawn_rate))

self._users_dispatcher.new_dispatch(user_count, spawn_rate)

Expand Down Expand Up @@ -694,8 +694,6 @@ def start(self, user_count: int, spawn_rate: float, **kwargs) -> None:
self._users_dispatcher.new_dispatch(target_user_count=user_count, spawn_rate=spawn_rate)

try:
dispatched_users = None

for dispatched_users in self._users_dispatcher:
dispatch_greenlets = Group()
for worker_node_id, worker_user_classes_count in dispatched_users.items():
Expand Down Expand Up @@ -724,7 +722,6 @@ def start(self, user_count: int, spawn_rate: float, **kwargs) -> None:
"Currently spawned users: %s" % _format_user_classes_count_for_log(self.reported_user_classes_count)
)

assert dispatched_users is not None
self.target_user_classes_count = _aggregate_dispatched_users(dispatched_users)

except KeyboardInterrupt:
Expand Down Expand Up @@ -771,12 +768,9 @@ def _wait_for_workers_report_after_ramp_up(self) -> float:
if match is None:
assert float(locust_wait_for_workers_report_after_ramp_up) >= 0
return float(locust_wait_for_workers_report_after_ramp_up)

if match is not None:
else:
return float(match.group("coeff")) * WORKER_REPORT_INTERVAL

assert False, "not supposed to reach that"

def stop(self, send_stop_to_client: bool = True):
if self.state not in [STATE_INIT, STATE_STOPPED, STATE_STOPPING]:
logger.debug("Stopping...")
Expand Down

0 comments on commit 01162ac

Please sign in to comment.