hypermodel.utilities package¶
Submodules¶
hypermodel.utilities.hm_shell module¶
-
hypermodel.utilities.hm_shell.
sh
(cmd: str, cwd: str = '.', env=None, debug: bool = False, ignore_error: bool = False) → Tuple[int, str, str]¶ Execures a shell command using ‘subprocess.Popen’, returning a tuple
hypermodel.utilities.k8s module¶
Utility functions to make it easier to work with Kubernetes, primarily just a wrapper around kubectl commands
-
hypermodel.utilities.k8s.
connect
(cluster_name: str, zone: str, project: str) → None¶ Using gcloud, set up the environment to connect to the specified cluster, given by
cluster_name
in thezone
andproject
.Parameters: - cluster_name (str) – The name of the cluster
- zone (str) – The zone the cluster was created in (e.g. ‘australia-southeast1-a’)
- project (str) – The google cloud project you wish to connect to
Returns: Returns True if everything worked as expected
-
hypermodel.utilities.k8s.
sanitize_k8s_name
(name: str)¶ From _make_kubernetes_name sanitize_k8s_name cleans and converts the names in the workflow.
-
hypermodel.utilities.k8s.
secret_from_env
(env_var: str, namespace: str) → bool¶ Create a Kubernetes secret in the provided
namespace
using an environment variable given byenv_var
.Parameters: - env_var – The name of the environment variable to save as a secret
- namespace – The Kubernetes namespace to save the secret in
Returns: Returns True if everything worked as expected
-
hypermodel.utilities.k8s.
secret_to_file
(secret_name: str, namespace: str, path: str) → bool¶ Find the secret named
secret_name
in the namespacenamespace
and save it to a file at the path given bypath
Parameters: - secret_name – The name of the secret we want to export
- namespace – The namespace that the secret lives in
- path – The path to a directory where we want to save the secret files
Returns: Returns True if everything worked as expected
hypermodel.utilities.kubeflow module¶
Utility functions for working with Kubeflow
-
hypermodel.utilities.kubeflow.
am_in_kubeflow
() → bool¶ Answers the question: ‘Am I currently being executed in a Kubeflow Pipeline Workflow by checking to see if we have an environment variables called ‘KF_WORKFLOW_ID’
Returns: True if I am running in a Kubeflow Pipelines