You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to use the latest version of OpenAPI generator to generate the library. That version uses Pydantic2 to generate models. Unfortunately kubernetes library contains ~600 models/api and loading time (at startup) is huge and not acceptable, especially for scripts, long running applications import modules once so it's not so painful. I tried to replace imports with lazy imports as a workaround but it's still 10 time worse in compare with current version using old generator.
My tests:
kubectl, local cluster (as a reference), get pods (9) from all namespaces - 0.12 sec
this library, current version, example1.py to list pods - 0.50 sec
OpenAPIGenerator v 7.0.1, example1.py - 17.26 sec
OpenAPIGenerator like above with some lazy imports (for models, apis) - 5.22 sec
For now I' m going to switch to the version just before Pydantic. It helps to resolve some pending issues, and this issue is for tracking ideas or attempts for future upgrades.
The text was updated successfully, but these errors were encountered:
@tomplus maybe it would be worth having a generator option to not load all the models from the __init__.py files (both client/__init__.py and client/models/__init__.py)
Typically, I'm using only a very small subset of all the available models, but importing kubernetes_asyncioalways loads them all.
If we could reduce this default list to something smaller, and have to explicitly import the extra classes you need, I think it could help a lot.
I did such tests using lazy imports (models were loaded only when needed) and it worked 3x faster but still 10x slower than the current version (see timings above). The problem is that each model requires other models and these models required others and still you need to load many of them...
I've tried to use the latest version of OpenAPI generator to generate the library. That version uses Pydantic2 to generate models. Unfortunately kubernetes library contains ~600 models/api and loading time (at startup) is huge and not acceptable, especially for scripts, long running applications import modules once so it's not so painful. I tried to replace imports with lazy imports as a workaround but it's still 10 time worse in compare with current version using old generator.
My tests:
The problem is known and may be resolved in the future: pydantic/pydantic#6748
For now I' m going to switch to the version just before Pydantic. It helps to resolve some pending issues, and this issue is for tracking ideas or attempts for future upgrades.
The text was updated successfully, but these errors were encountered: