-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a way for "Device" Locust class to pass a value to the TaskSet #906
Comments
FYI - Locust's Line 301 in ff7fddd
|
@devmonkey22 you rocked! So simple.
so no need for any init like you mentioned. |
You should be able to |
Thanks |
Description of issue / feature request
Working on a MQTT Locust client for load test against an MQTT broker.
The first part works fine using super, but we've not been able to figure out a way for the Device class to tell the TaskSet which clientID it needs to run the publishing requests.
We've tried many things, including trying to init the TaskSet with the clientID
Question: once the Device object figures out its clientID (through choosing randomly from a datafile) is there a way to pass the clientID to the TaskSet? We can't let the TaskSet pick it since it's too late (the ID is needed to initialize the MQTT client, and conceptually the Device would need to know its ID wouldn't it?)
Expected behavior
DeviceBehavior(TaskSet) class will happily accept the clientID and run the tasks with it
Actual behavior
When passed through the init of DeviceBehavior:
locust().run(runner=self)
File "/Users/quan/Library/Python/2.7/lib/python/site-packages/locust/core.py", line 158, in run
task_set_instance = self.task_set(self)
TypeError: 'DeviceBehavior' object is not callable
Environment settings (for bug reports)
Excerpts of the classes involved:
The text was updated successfully, but these errors were encountered: