Hi, I am trying to use a `node_selecto`r in the `@...
# ask-metaflow
f
Hi, I am trying to use a `node_selecto`r in the
@kubernetes
decorator, I am not sure how to specify the nodeselector label(s). We have 3 labels (I've read that all 3 labels should be specified in a yaml pod/job definition). I have tried several ways (list, str, tuple(str)), but none seems to work. For example:
Copy code
[spec.template.spec.nodeSelector: Invalid value: "nvidia-ampere-a10g,<http://veo.co/nodegroup-family=gpu_dem_g4_2x,nvidia.com/gpu=true|veo.co/nodegroup-family=gpu_dem_g4_2x,nvidia.com/gpu=true>": must be no more than 63 characters, spec.template.spec.nodeSelector: Invalid value: "nvidia-ampere-a10g,<http://veo.co/nodegroup-family=gpu_dem_g4_2x,nvidia.com/gpu=true|veo.co/nodegroup-family=gpu_dem_g4_2x,nvidia.com/gpu=true>": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')]
my labels have
/
but the validation regex is only alphanumeric? any advice on how to specify several labels for the node selector on the decorator? thanks a lot 🙂
👀 1
1
u
You shouldn't have to use multiple labels. Using a single label should be enough for influencing K8s to schedule the pod on the node. I just tried the following and it worked just fine:
Copy code
$ python3.10 starter_flow.py run --with kubernetes:node_selector="<http://kubernetes.io/hostname=ip-10-10-9-120.us-west-2.compute.internal|kubernetes.io/hostname=ip-10-10-9-120.us-west-2.compute.internal>"
f
Great, I’ll give it a shot. What about the regex validator in the decorator? Would it accept your node_selector even if this has a /
u
As long as the node selector is passed as a string (see the
"
in the usage above), the string should get passed down to K8s and it should work. The example i tried above had the
/
and it worked fine.
f
Sweet, thank you 🙏🏾
👍 1