locust icon indicating copy to clipboard operation
locust copied to clipboard

Users can raise `RescheduleTask` but TaskSets cannot?

Open bakhtos opened this issue 1 year ago • 1 comments

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?

bakhtos avatar Mar 26 '24 10:03 bakhtos

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

cyberw avatar Mar 26 '24 19:03 cyberw

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!

github-actions[bot] avatar May 21 '24 01:05 github-actions[bot]