diff --git a/locust/dispatch.py b/locust/dispatch.py index 9b4ec019a7..a188ae9dd0 100644 --- a/locust/dispatch.py +++ b/locust/dispatch.py @@ -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]]]: diff --git a/locust/runners.py b/locust/runners.py index c8fc297299..617d39fe71 100644 --- a/locust/runners.py +++ b/locust/runners.py @@ -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) @@ -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(): @@ -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: @@ -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...")