6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +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:
Régis Behmo 2019-04-09 18:28:19 -07:00
parent 1a706889b2
commit b2d8c1b6cc
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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