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 from command line #48

Closed
wants to merge 4 commits into from

Conversation

kevinpetersavage
Copy link

Hi guys,

We were trying to use locust with our Jenkins CI. In order to get feedback to Jenkins we wanted to get the CSV files that are produced in the web ui from the command line interface. I found this was nearly just moving stuff about in the code so I just did it.

It would be great if this could be included in a future release.

Great tool btw!

Kevin

@heyman
Copy link
Member

heyman commented Dec 7, 2012

Hi, and thanks for the pull request and input! Always good to get info on how others use the product, and your Jenkins integration sounds cool.

I'm not going to merge this right away, because I think the right way to implement this, would be to move the CSV generation code into the locust.stats.RequestStats class (which btw, has been in bad need of a refactoring for a while now, but that's another issue I guess).

Then it would be really easy to write a few lines of code in your locust scripts, that uses the locust.events.quitting event, to get this functionality. Something like this:

from locust import events
from locust.stats import RequestStats

def on_quitting():
    distribution_csv = RequestStats.get_distribution_stats_csv()
    requests_csv = RequestStats.get_request_stats_csv()
    # insert code to write the data to files here

events.quitting += on_quitting

If you want to, you can update your pull request to do it this way, and preferably create unit tests for the RequestStats functions. Otherwise, I'll try to implement this myself for the next version.

@HelloGrayson
Copy link

This looking to get merged anytime soon? Would love Jenkins support.

@sanga
Copy link
Contributor

sanga commented Oct 5, 2013

Btw, we run locust under jenkins and get the csv at the end of the perf test just by doing:

curl localhost:8089/requests/stats/csv -o requests_stats.csv

in the same way, you can start and change the number of locusts by calling the web api with curl and in that way you have the webui running which is on occasion nice to inspect during the perf run (nicer than the cmd line at least)

@HelloGrayson
Copy link

@sanga thanks this is great :)

@cgbystrom
Copy link
Member

@sanga Would love to see a blog post explaining your use of Locust with Jenkins.

@daubman
Copy link
Contributor

daubman commented Oct 16, 2013

+1 - This is the type of thing I've been anticipating setting up for ages now and still have not gotten around to, would be great to see details of somebody else's experience here =)

@sanga
Copy link
Contributor

sanga commented Oct 22, 2013

Yup, I guess I could do this. I gave a talk inside my company about how we use locust in our project which, with some small cleanup and anonymization that could probably be uploaded somewhere. Short take-away: it works and it's way nicer than how we used to do things with JMeter :)

@cgbystrom
Copy link
Member

@sanga Would be nice indeed!

@anaximander
Copy link

Looks like this pull request was never updated or incorporated. Has anything similar to this been officially implemented? We are trying to do the same thing (integrate test results with Jenkins). Thanks @sanga for the workaround, in any case.

@kowalcj0
Copy link

kowalcj0 commented Feb 6, 2015

I'd love to have the option to store csv reports. How can we contribute to this PR to get it on master?

@hampsterx
Copy link

+1

1 similar comment
@louisnayegon
Copy link

+1

@thedrow
Copy link

thedrow commented May 7, 2015

I think that this should be closed until someone tackles it.

@cgoldberg
Copy link
Member

@thedrow i think #252 supersedes this

@giantryansaul
Copy link
Contributor

+1 really would love this feature in master.

@fatso83
Copy link

fatso83 commented Jan 25, 2016

This could be closed with #252 pending.

@sngpranay
Copy link

To download csv from command line, curl localhost:8089/stats/requests/csv -o requests_stats.csv

@sj2208
Copy link

sj2208 commented Oct 21, 2016

@heyman anything on such feature of getting csv while running in no-web mode ?

@mbeacom
Copy link
Member

mbeacom commented Sep 8, 2017

Closed in favor of #612 (merged) - Thank you!

@mbeacom mbeacom closed this Sep 8, 2017
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

Successfully merging this pull request may close these issues.