How to use create_worker_runner method in locust

Best Python code snippet using locust

client.py

Source:client.py Github

copy

Full Screen

...32 self.max_runtime = max_runtime33 self.node_type = node_type34 self.ecs = boto3.client("ecs", region_name=region)35 if node_type == "worker":36 self.env.create_worker_runner(master_host, master_port)37 self.master_fargate_task = master_fargate_task38 else:39 if node_type == "master":40 self.env.create_master_runner(master_host, master_port)41 self.expected_workers = int(expected_workers)42 if node_type == "local":43 self.env.create_local_runner()44 self.stages_shape.runner = self.env.runner45 self.percentiles = percentiles.split(",")46 def start_master(self):47 """Wait for all worker nodes to connect and start the load testing"""48 while len(self.env.runner.clients.ready) < self.expected_workers:49 time.sleep(1)50 gevent.spawn(stats_printer(self.env.stats))...

Full Screen

Full Screen

transaction_example_as_library_worker.py

Source:transaction_example_as_library_worker.py Github

copy

Full Screen

...16class TranactionExample(HttpUser):17 host = "https://www.demoblaze.com"18 tasks = [ExampleSequentialTaskSet]19env = Environment(user_classes=[TranactionExample])20env.create_worker_runner("127.0.0.1", 5557)21locust.events.init.fire(environment=env, runner=env.runner)22env.events.report_to_master.add_listener(TransactionManager._report_to_master)...

Full Screen

Full Screen

locust_workers.py

Source:locust_workers.py Github

copy

Full Screen

...8 logging.info('*******************')9 logging.info('{}'.format("Starting Worker"))10 logging.info('*******************')11 env = Environment(user_classes=[UserGlobal], host="http://192.168.2.12:32677")12 env.create_worker_runner(master_host="192.168.2.12", master_port=5557)13 env.runner.greenlet.join()14 print("Complete worker...")15if __name__ == '__main__':16 threads = []17 for i in range(2):18 t = threading.Thread(target=start_locust_worker)19 threads.append(t)20 for x in threads:21 x.start()22 for x in threads:23 x.join()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful