Sergei
Sergei

Reputation: 195

How to get Locust worker ID?

I ran into one problem when tried to write some tests for load testing using Locust.

The idea: I have to link a specific locust worker (thread) to a specific account. For example:

thread #1 will use only account1,password1

thread #2 will use only account2,password2

But I did not find any option how to do this. Could anyone help with this issue or give an advice with a workaround? Thanks in adcance!

Upvotes: 2

Views: 2199

Answers (1)

Cyberwiz
Cyberwiz

Reputation: 11426

You can get the greenlet id of the currently running locust by using greenlet.getcurrent().minimal_ident

This id is not global, so if you run master-slave you may need to differentiate between slaves, if you need some kind of globally unique identifier (but I'm guessing you dont :)

Upvotes: 2

Related Questions