def interrupt(self, reschedule=True): """ Interrupt the SubLocust and hand over execution control back to the parent Locust. If *reschedule* is True (default), the parent Locust will immediately re-schedule, and execute, a new task """ raise InterruptLocust(reschedule)
def on_request_success(method, name, response_time, response): if RequestStats.global_max_requests is not None and RequestStats.total_num_requests >= RequestStats.global_max_requests: raise InterruptLocust("Maximum number of requests reached") content_length = int(response.info.getheader("Content-Length") or 0) RequestStats.get(method, name).log(response_time, content_length)