Skip to content

Commit

Permalink
debug python sdk termination log (#123)
Browse files Browse the repository at this point in the history
we need the get pods function to be allowed to get
a 404 response when we are waiting for termination

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Co-authored-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch and vsoch committed Mar 20, 2023
1 parent 1357dfe commit 09158e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hack/python-sdk/template/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
if __name__ == "__main__":
setup(
name="fluxoperator",
version="0.0.19",
version="0.0.2",
author="Vanessasaurus",
author_email="vsoch@users.noreply.github.com",
maintainer="Vanessasaurus",
Expand Down
1 change: 1 addition & 0 deletions sdk/python/v1alpha1/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip. Only major versions will be released as tags on Github.

## [0.0.x](https://github.com/flux-framework/flux-operator/tree/main/sdk/python/v2alpha1) (0.0.x)
- tweak deletion logic to allow 404 response from get pods (0.0.2)
- refactor of FluxOperator to include FluxMiniCluster to wrap it (0.0.19)
- Support for post command (0.0.18)
- Tweaks to client and pod resources (bugfix) for snakemake work (0.0.17)
Expand Down
7 changes: 7 additions & 0 deletions sdk/python/v1alpha1/fluxoperator/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from kubernetes import client, watch
from kubernetes.stream import stream
from kubernetes.client.api import core_v1_api
from kubernetes.client.models.v1_pod_list import V1PodList

import kubernetes.client.exceptions
from contextlib import contextmanager
from .resource.network import port_forward
from .resource.pods import create_minicluster, delete_minicluster
Expand Down Expand Up @@ -294,6 +297,10 @@ def get_pods(self, namespace, name=None):
if name is not None:
pods = self._filter_pods(pods, name)
return pods

# Not found - it was deleted
except kubernetes.client.exceptions.ApiException:
return V1PodList(items=[])
except:
time.sleep(2)
return self.get_pods(namespace, name)
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/v1alpha1/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
if __name__ == "__main__":
setup(
name="fluxoperator",
version="0.0.19",
version="0.0.2",
author="Vanessasaurus",
author_email="vsoch@users.noreply.github.com",
maintainer="Vanessasaurus",
Expand Down

0 comments on commit 09158e2

Please sign in to comment.