hypermodel.utilities package


hypermodel.utilities.file_hash module


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 the zone and project.

  • 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 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 by env_var.

  • env_var – The name of the environment variable to save as a secret
  • namespace – The Kubernetes namespace to save the secret in

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 namespace namespace and save it to a file at the path given by path

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

Module contents