locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
24.95k stars 2.99k forks source link

Users can raise `RescheduleTask` but TaskSets cannot? #2652

Closed bakhtos closed 5 months ago

bakhtos commented 7 months ago

Prerequisites

Description

So as far as I understand, Users can raise RescheduleTask error directly in the code, but TaskSets use this error internally so inside a TaskSet task one needs to use self.interrupt(), otherwise raising RescheduleTask causes unexpected behaviour?

I had an issue with my code where I first implemented some tasks directly inside a User instance and they raised RescheduleTask error, but then I refactored the code so that the tasks are inside a TaskSet, and there was unexpected behaviour with these tasks (locust seemed to be stuck inside one as soon as it was executed) until I replaced all instances of raise RescheduleTask() with self.interrupt().

Should the interface be somehow unified so that both Users and TaskSets have methods e.g. self.reschedule() and self.interrupt()and RescheduleTask error is only used internally and never raised in user-written code?

cyberw commented 7 months ago

I guess? I dont really use TaskSets and have never seen the point in using them so I dont know :)

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!