From fb2d9750797ec2a1c8fd6b1e63f6db34e08bb947 Mon Sep 17 00:00:00 2001 From: Oleg Avdeev Date: Mon, 11 Oct 2021 20:26:37 -0700 Subject: [PATCH] rename name_space to namespace for k8s plugin --- metaflow/plugins/aws/eks/kubernetes_cli.py | 8 ++++---- metaflow/plugins/aws/eks/kubernetes_decorator.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/metaflow/plugins/aws/eks/kubernetes_cli.py b/metaflow/plugins/aws/eks/kubernetes_cli.py index d6c44d54e5f..4856f6d4863 100644 --- a/metaflow/plugins/aws/eks/kubernetes_cli.py +++ b/metaflow/plugins/aws/eks/kubernetes_cli.py @@ -61,9 +61,9 @@ def kubernetes(): ) @click.option( # Note that ideally we would have liked to use `namespace` rather than - # `name-space` but unfortunately, `namespace` is already reserved for + # `k8s-namespace` but unfortunately, `namespace` is already reserved for # Metaflow namespaces. - "--name-space", + "--k8s-namespace", default=None, help="Namespace for Kubernetes job on Amazon EKS.", ) @@ -109,7 +109,7 @@ def step( service_account=None, secrets=None, node_selector=None, - name_space=None, + k8s_namespace=None, cpu=None, gpu=None, disk=None, @@ -210,7 +210,7 @@ def _sync_metadata(): service_account=service_account, secrets=secrets, node_selector=node_selector, - namespace=name_space, + namespace=k8s_namespace, cpu=cpu, gpu=gpu, disk=disk, diff --git a/metaflow/plugins/aws/eks/kubernetes_decorator.py b/metaflow/plugins/aws/eks/kubernetes_decorator.py index 80fdeae0102..813aab054a4 100644 --- a/metaflow/plugins/aws/eks/kubernetes_decorator.py +++ b/metaflow/plugins/aws/eks/kubernetes_decorator.py @@ -72,7 +72,7 @@ def my_step(self): "node_selector": None, # e.g., kubernetes.io/os=linux "gpu": "0", # "shared_memory": None, - "name_space": None, + "namespace": None, } package_url = None package_sha = None @@ -180,7 +180,14 @@ def runtime_step_cli( cli_args.commands = ["kubernetes", "step"] cli_args.command_args.append(self.package_sha) cli_args.command_args.append(self.package_url) - cli_args.command_options.update(self.attributes) + + # --namespace is used to specify Metaflow namespace (different + # concept from k8s namespace). + for k,v in self.attributes.items(): + if k == 'namespace': + cli_args.command_options['k8s_namespace'] = v + else: + cli_args.command_options['namespace'] = v cli_args.command_options["run-time-limit"] = self.run_time_limit cli_args.entrypoint[0] = sys.executable