-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Report name #2947
base: master
Are you sure you want to change the base?
Report name #2947
Conversation
Signed-off-by: Olivier Briat <[email protected]>
… doc about dev Signed-off-by: Olivier Briat <[email protected]>
Can you do this without adding the humanfriendly dependency? Seems a bit much to add an entire package just to format one date... There's already some info about debugging in running-in-debugger.rst, can you maybe add your info there instead (and link to it from developing-locust.rst) @andrewbaldwin44 Any opinions on the TS stuff? |
@obriat Could you also check that this works with the |
I'm not a Python expert, but does this package adds a overhead to the runners or just the report part?
I'll move my doc to this page |
Hey there! Not a mantainer, but, I don't think the issue is adding a overhead, it's having to add a full package (that hasn't been updated since 2020) just to format a date for a report, I'd say that adding your own implementation would be better :) You can always check how humanfriendly does it! It really isn't hard nor long! |
About the
|
""" | ||
# Common time units, used for formatting of time spans. | ||
time_units = ( | ||
dict(divider=1e-9, singular="nanosecond", plural="nanoseconds", abbreviations=["ns"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry maybe it wasn't clear, but I think an argument for using our own solution, rather than the library, is because as you can probably see, the library handles a lot more cases than we probably need. In Locust's case, we probably never need nanoseconds, microseconds, weeks, or years. I think we could go with a simpler approach, for example:
def format_duration(start_time, end_time):
time_diff = end_time - start_time
days = time_diff.days
seconds = time_diff.seconds
hours = seconds // 3600
minutes = (seconds % 3600) // 60
seconds = seconds % 60
return f"{days} days, {hours} hours, {minutes} minutes, {seconds} seconds"
(disclaimer: ChatGPT)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I keep some methods in order to keep it human friendly (plural, no output for 0 values, ...)?
Hey @obriat, for the |
Close #2931