-
Notifications
You must be signed in to change notification settings - Fork 10
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
[#438] Fix accessing unknown deployments #440
Conversation
ok to test |
Build status: FAILURE |
ok to test |
Build status: FAILURE |
Code should be replaced in order to 1) add retries to kube API reading function 2) raise error if cannot find deployment |
ok to test |
Build status: FAILURE |
1 similar comment
Build status: FAILURE |
ok to test |
Build status: FAILURE |
1 similar comment
Build status: FAILURE |
ok to test |
Build status: FAILURE |
Build status: SUCCESS |
Code should be replaced to unified function with API for iterable function call (retries) |
ok to test |
1 similar comment
ok to test |
Build status: FAILURE |
previous build has been aborted |
Build status: SUCCESS |
1 similar comment
Build status: SUCCESS |
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.
Quick changes?
legion/legion/utils.py
Outdated
timeout)) | ||
time.sleep(timeout) | ||
|
||
raise Exception('No retries left') |
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 rather return False here in case if the internal function does not succed. Then you can handle the error on a caller's side an provide more meaningful error message.
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.
Okay, will do
legion/legion/utils.py
Outdated
@@ -588,3 +591,30 @@ def deduce_model_file_name(model_id, model_version): | |||
return os.path.join(default_prefix, file_name) | |||
|
|||
return file_name | |||
|
|||
|
|||
def retry_function_call(function_to_call, retries, timeout): |
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.
ensure_function_succed(...) ?
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.
Why?
Build status: FAILURE |
ok to test |
Build status: FAILURE |
ok to test |
Build status: SUCCESS |
legion/legion/k8s/services.py
Outdated
client = legion.k8s.utils.build_client() | ||
|
||
extension_api = kubernetes.client.ExtensionsV1beta1Api(client) | ||
|
||
all_deployments = extension_api.list_namespaced_deployment(self._k8s_service.metadata.namespace) | ||
model_deployments = [deployment for deployment in all_deployments.items |
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.
Change to next(
legion/legion/k8s/services.py
Outdated
return | ||
|
||
self._deployment = ensure_function_succeed(self._load_deployment_data_logic, | ||
LOAD_DATA_ITERATIONS, LOAD_DATA_TIMEOUT) | ||
self._deployment_data_loaded = True |
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.
Add logging
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.
👍
b28e0b7
to
6066ca0
Compare
ok to test (after rebase and adding some new logic) |
legion/legion/k8s/services.py
Outdated
extension_api = kubernetes.client.ExtensionsV1beta1Api(client) | ||
|
||
all_deployments = extension_api.list_namespaced_deployment(self._k8s_service.metadata.namespace) | ||
try: |
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.
the default value - None for the function next() would be better than try/except approach. See https://docs.python.org/2/library/functions.html#next
Build status: SUCCESS |
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.
👍
Build status: FAILURE |
ok to test |
This closes #438