Skip to content

Instantly share code, notes, and snippets.

View cyberw's full-sized avatar

Lars Holmberg cyberw

View GitHub Profile
@cyberw
cyberw / debugging_locust.py
Last active May 31, 2019 13:49
Debug locust using VS code (PTVS). Just go to debug, add a debug configuration, select "python file" and run it when standing in the locust script.
if __name__ == "__main__":
with open("enable_gevent_debugging.py", "r") as myfile:
exec(myfile.read()) # pylint: disable=W0122
from locust import HttpLocust, TaskSet, task
class WebTaskSet(TaskSet):
@task
def asdf(self):
@cyberw
cyberw / user_test.py
Last active July 6, 2021 23:02
poc user distribution
from collections import defaultdict
from itertools import cycle
from locust import User
def batch_iter(batch_size, iter_):
yield [next(iter_) for _ in range(batch_size)]
def user_gen(user_classes, worker_count):