Hi everyone, Does anyone know how to pass a Param...
# ask-metaflow
j
Hi everyone, Does anyone know how to pass a Parameter value to a decorator? e.g.
Copy code
...
node_selector_params = Parameter(
    "node_selector_params",
    help="Node selector dictionary",
    default={"key": "value"},
    type=JSONType,
)
...
...
@kubernetes(
    service_account="...",
    image="...",
    image_pull_policy="Always",
    cpu=1,
    gpu=1,
    node_selector=<DYNAMIC_DICT_HERE>
    memory=4096,
    disk=10240,
)
...
...
βœ… 1
s
Hi! I think this might be what you are looking for https://docs.metaflow.org/metaflow/configuring-flows/basic-configuration
πŸ™Œ 1
j
I could not get my head around that doc.
I could use a config, but then I won't be able to use a trigger and set it?
s
Correct - these are deploy time variables
j
One way of doing this is getting the val from the parameter and setting
METAFLOW_KUBERNETES_NODE_SELECTOR
for the next step, right?
I just don't want to build the image each time I want to experiment with a new node πŸ™‚
s
Curious - what’s the use case? I would be happy to explore alternatives
j
My goal is to pick the best (performance/cost) gpu instances for the job, and compare them.
Using karpenter + node_selector to get the exact gpu instance I need provisioned.
AI/ML images can get huge in size, and building them takes time. So for each "experiment" there is a lag and interruption in the development process. Metaflow is great, and thank you! I may be asking for too much flexibility here πŸ™‚
a
re: baking images ultra fast, we do have a solution in outerbounds πŸ™‚
also, re: configs - here is another pattern that can run multiple runs with different configs that you can potentially embed inside a deployed flow
j
Thank you so much, I'll look into these.