mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-12 06:07:56 +00:00
Improve cold start time by moving kubernetes import
"import kubernetes" takes a long time. Moving this import improves "tutor --version" from 0.8s to 0.3s.
This commit is contained in:
parent
1a706889b2
commit
b2d8c1b6cc
@ -2,6 +2,7 @@
|
||||
|
||||
## Latest
|
||||
|
||||
- [Improvement] Improve CLI cold start performance
|
||||
- [Improvement] Allow uppercase "Y" and "N" as answers to boolean questions
|
||||
|
||||
## v3.3.4 (2019-04-09)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import click
|
||||
import kubernetes
|
||||
|
||||
from . import config as tutor_config
|
||||
from . import env as tutor_env
|
||||
@ -138,6 +137,8 @@ class K8s:
|
||||
@property
|
||||
def client(self):
|
||||
if self.CLIENT is None:
|
||||
# Import moved here for performance reasons
|
||||
import kubernetes
|
||||
kubernetes.config.load_kube_config()
|
||||
self.CLIENT = kubernetes.client.CoreV1Api()
|
||||
return self.CLIENT
|
||||
|
Loading…
Reference in New Issue
Block a user