https://dagster.io/ logo
Title
n

Nolan Nichols

11/17/2022, 12:06 AM
Hi, I'm using the
k8s_job_executor
and specifying
tolerations
/
nodeSelector
tags so that pods will run on a specific node group. This works as expected for the
run
pod where I can see that my
tags
were properly applied in the pod's yaml file and the pod runs on a node in the correct node group; however, the
step
pods do not execute on the correct node group and when I examine the
step
pod yaml file the
tolerations
/
nodeSelector
tags are not present. Is this the expected behavior? Is there another way to add tags to individual step pods?
Here is how I am configuring my asset job
metsim_assets_job = dagster.define_asset_job(
    name="metsim_asset_job",
    selection=dagster.AssetSelection.groups("metsim"),
    executor_def=k8s_job_executor,
    tags={
        "dagster-k8s/config": {
            "container_config": {
                "resources": {
                    "requests": {"cpu": "8000m", "memory": "10Gi"},
                    "limits": {"cpu": "8000m", "memory": "10Gi"},
                },
            },
            "pod_template_spec_metadata": {
                "annotations": {
                    "<http://cluster-autoscaler.kubernetes.io/safe-to-evict|cluster-autoscaler.kubernetes.io/safe-to-evict>": "true"
                }
            },
            "pod_spec_config": {
                "tolerations": [
                    {"key": "mazeApp", "value": "dagster", "effect": "NoSchedule"}
                ],
                "nodeSelector": {"AppUsed": "dagster"}
            },
        },
    },
)
d

daniel

11/17/2022, 12:45 AM
Hey Nolan - for it to apply to the step pods, I believe you’d want those same tags to be on each asset - since each asset maps to a step pod
n

Nolan Nichols

11/17/2022, 12:50 AM
Thanks, Daniel - that makes sense. I'm using `dagster.AssetsDefinition.from_graph`so then for each
op
in my graph I would add the same tags that I am currently adding just at the
dagster.define_asset_job
level?
d

daniel

11/17/2022, 12:51 AM
That's my understanding, yeah - bit verbose but the tags can of course go in a separate variable
n

Nolan Nichols

11/17/2022, 12:52 AM
Yup, I mean it makes sense given that a step maps to an op... I'll give it a shot and let you know how it goes!
Worked like a charm - thank you!
:condagster: 1
Note that I missed the docs for this here. I was expecting some mention of this in the apidocs for
k8s_job_executor
, so I added a note to the doc string in this PR :merged: