-
Notifications
You must be signed in to change notification settings - Fork 29
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
Gnocchiclient is slow to start #26
Comments
personally, i don't see openstack-ness as a con (or pro). i just don't want us to remove openstack just because it's openstack. ie. i'd prefer we look at alerting engine, clean up carbonara's pandas usage before this. disclaimer: my benchmarks don't use gnocchiclient so i have very little performance experience against it. |
2s to print help. 2s to start basically. I've been chatting with a sysadmin recently that wrote a bash script using
We probably need a new format that do not exist neither in cliff nor click. Tables are cool but when nothing fits in width, it's useless. You can't copy/paste any uuid easily… It's terrible UX.
We're trying to build an opensource project, so it's a con in that regard. Consequently cliff is barely maintained by just one dev AFAICS. I don't disagree with what you consider priorities, but this is also huge. It's part of our UX, and our UX sucks right now because of that. Gnocchi seems slow because the first thing sysadmin do is "gnocchi metric list" and it takes more than 2 seconds to list 0 metric. :( |
is that 2s overhead every single command? i find the table formatting (cliff?) is what really sucks. |
I think it's python entry_points/pkg_resource that's slow, and cliff is not the only lib that use the use them. Until we remove all libs that use them, we will not remove the 2s overhead. |
Yep
Agree, it's a first step. :) |
I don't think the output of cliff is as bad as you make it out to be. Remember that the default output is meant to be human readable, so it's formatted to look pretty in a terminal, but if you're passing it too much information there's not much it can do with a stanard 80 column window. The output isn't so bad by default if you work regularly with wider terminals, and you have a lot of control over what the output looks like. For example, you can limit it to only specific fields:
That fits on my terminal just fine. And if I want machine readable output suitable for input to a script, I can select, e.g., csv output:
Or even JSON:
The ability to select the field that appear in the output as well as the format of the output is very useful. I think it would be a bad idea to abandon I'm also not sure why you're seeing such a slow startup time. On my own system:
|
Yeah I agree, that's why I've put in in a pro for cliff and cons for $other. :)
Hum that might depend on the number of other libraries you have installed and that register entry points. As @sileht pointed out, keystoneauth also suffers from this syndrom, so that might be one reason my startup is so slow. I'll need to dig further! |
1.1s to import pkg_resources, which is imported by stevedore, which is imported by cliff and keystoneauth1. This is really a problem. I've less entry points and packages listed on my Python 3 system but still:
0.3s on startup for extensions we don't really need. :( |
Find an interesting discussion around that here: pypa/setuptools#510 |
Started to profile and hack on |
gnocchiclient leverages cliff (https://github.com/openstack/cliff), an OpenStack home made command line parser. To be short, I'll try to summarize the pros/cons of cliff:
Pros
Cons
I'm starting to think we should just ditch it, as it's not very likely we can solve the cons. I've been looking into something that seems wildly used by the Python community, named click: http://click.pocoo.org/
My analysis give the following:
Pros
Cons
Click can have plugins, and there are some here: https://github.com/click-contrib
Since Gnocchi is not an OpenStack project anymore, there's no reason to have the OpenStack CLI integration kept around (except by convenience). I'm leaning toward replacing cliff by click, but since it's a rather big change, I'd prefer to have objections before starting to write any code.
I'm also not stuck on Click, but it seems like the best option. Using
argparse
directly would be a PITA.The text was updated successfully, but these errors were encountered: