-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
stall-analyser: gracefully handle empty input #2305
stall-analyser: gracefully handle empty input #2305
Conversation
scripts/stall-analyser.py
Outdated
if t >= tmin: | ||
graph.process_trace(trace, t) | ||
|
||
try: | ||
if not graph: | ||
print("No input data found. Please run `stall-analyser.py --help` for usage instruction") | ||
exit(0) |
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.
i'd suggest use sys.exit()
instead. see https://docs.python.org/3/library/constants.html#constants-added-by-the-site-module . i am quoting the remarks in the document.
They are useful for the interactive interpreter shell and should not be used in programs.
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.
done
Currently, the tools prints an obscure error if the input is empty: ``` Traceback (most recent call last): File "/home/bhalevy/dev/scylla_s3_reloc_server/./seastar//scripts/stall-analyser.py", line 363, in <module> print_stats(tally, tmin) ^^^^ NameError: name 'tmin' is not defined. Did you mean: 'min'? ``` Instead, print a meaningful error and direct the user to run stall-analyser.py --help for usage instructions. Ref scylladb/scylla_s3_reloc_server#103 Signed-off-by: Benny Halevy <[email protected]>
12480e9
to
f0b62cb
Compare
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.
lgtm
@scylladb/seastar-maint please merge |
Currently, the tools prints an obscure error if the input is empty: ``` Traceback (most recent call last): File "/home/bhalevy/dev/scylla_s3_reloc_server/./seastar//scripts/stall-analyser.py", line 363, in <module> print_stats(tally, tmin) ^^^^ NameError: name 'tmin' is not defined. Did you mean: 'min'? ``` Instead, print a meaningful error and direct the user to run stall-analyser.py --help for usage instructions. Ref scylladb/scylla_s3_reloc_server#103 Signed-off-by: Benny Halevy <[email protected]> Closes scylladb#2305
Currently, the tools prints an obscure error if the input is empty: ``` Traceback (most recent call last): File "/home/bhalevy/dev/scylla_s3_reloc_server/./seastar//scripts/stall-analyser.py", line 363, in <module> print_stats(tally, tmin) ^^^^ NameError: name 'tmin' is not defined. Did you mean: 'min'? ``` Instead, print a meaningful error and direct the user to run stall-analyser.py --help for usage instructions. Ref https://github.com/scylladb/scylla_s3_reloc_server/pull/103 Signed-off-by: Benny Halevy <[email protected]> Closes scylladb#2305
Currently, the tools prints an obscure error
if the input is empty:
Instead, print a meaningful error and direct the user to run stall-analyser.py --help for usage instructions.
Ref https://github.com/scylladb/scylla_s3_reloc_server/pull/103