Skip to content
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

SequentialTaskSet handles task weights in an inconsistent way #2739

Closed
2 tasks done
bakhtos opened this issue May 27, 2024 · 0 comments · Fixed by #2742
Closed
2 tasks done

SequentialTaskSet handles task weights in an inconsistent way #2739

bakhtos opened this issue May 27, 2024 · 0 comments · Fixed by #2742

Comments

@bakhtos
Copy link
Contributor

bakhtos commented May 27, 2024

Prerequisites

Description

Currently, SequentialTaskSet does not allow its tasks attribute to be a dict, and throws the following error:

if isinstance(value, list):
     new_tasks.extend(value)
else:
     raise ValueError("On SequentialTaskSet the task attribute can only be set to a list")

However, if they weight is provided to the @task decorator, the tasks are actually repeated in the task list according to the weight:

if "locust_task_weight" in dir(value):
      # method decorated with @task
      for _ in range(value.locust_task_weight):
            new_tasks.append(value)

This is inconsistent.
It should be possible to provide task weights also in a dict, with similar repeated insertion into the list.
(Few would probably use it like that, but it removes the inconsistency).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant