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

csv data cannot be read When I read the csv file using a single machine distributed #198

Open
waitingSunset opened this issue Nov 12, 2024 · 2 comments

Comments

@waitingSunset
Copy link

class CSVDictReader(Iterator[Dict]):

def __init__(self, file, **kwargs):
    try:
        file = open(file)
    except TypeError:
        pass
    self.file = file
    self.reader = csv.DictReader(file, **kwargs)

def __next__(self):
    try:
        return next(self.reader)
    except StopIteration:
        self.file.seek(0, 0)
        next(self.reader)
        return next(self.reader)

当我使用单机分布式 读取csv 文件, 会出现csv数据读取不到的现象, csv的文件大小5MB左右

@waitingSunset
Copy link
Author

When I read the csv file using a single machine distributed, the phenomenon that the csv data cannot be read, the size of the csv file is about 5MB

@waitingSunset
Copy link
Author

from locust_plugins.csvreader import CSVDictReader
from locust import HttpUser, task

ssn_reader = CSVDictReader("ssn.csv")

class MyUser(HttpUser):
@task
def index(self):
customer = next(ssn_reader)
print(customer)
self.client.get(f"/?ssn={customer[0]}")

host = "http://example.com"

 when i use  locust -f locustfile.py --processes -1 start  this ssn_reader content is error

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

No branches or pull requests

1 participant