https://dagster.io/ logo
#ask-community
Title
# ask-community
c

Cristian Fuentes

08/17/2023, 8:33 PM
Hey folks, I'm new in dagster, learning while I'm trying to design a proper pipeline for my use case, one of the operations I need to run is executing a process which is a docker image. That's why I'm using k8s_job_op. I defined the configuration for "config_or_config_fn" based on the example (json format), and it's working perfectly fine. But I need to provide some of the values as parameters (not hard coded), can someone help me to understand how can I pass parameters to my k8s_job_op json definition from "outside"? example:
Copy code
first_op = k8s_job_op.configured(
    {
        "image": "busybox",
        "command": ["/bin/sh", "-c"],
        "args": ["echo <PARAMETER_FROM_OUTSIDE>"],
    },
    name="first_op",
)
🤖 1
d

Daniel Kilcoyne

08/17/2023, 8:53 PM
What do you mean by "outside"? Why not use env variables? It looks like
execute_k8s_job
supports env_vars which could be helpful
c

Cristian Fuentes

08/17/2023, 8:55 PM
Thanks Daniel, from outside I mean by executing the job either from the UI or by command line passing a set of different parameters, maybe using env_vars is useful. However this pipeline will receive different parameters for different users, so we are expecting to have most of the values of the JSON definition parametrized. I tried to use Configurations (https://docs.dagster.io/concepts/configuration/config-schema) according to the examples config is a parameter of the op function
Copy code
@op
def print_greeting(config: MyOpConfig):
But when using k8s_job_op not sure how to provide "config".
a

alex

08/18/2023, 4:14 PM
k8s_job_op
here https://github.com/dagster-io/dagster/blob/master/python_modules/libraries/dagster-k8s/dagster_k8s/ops/k8s_job_op.py#L368-L394 is a very thin wrapper around
execute_k8s_job
as Daniel alluded to above. Writing your own
op
that uses
execute_k8s_job
directly and allow you to define your own config should give you the flexibility you need to accomplish what you are trying
c

Cristian Fuentes

08/18/2023, 4:17 PM
Hi @alex thank you, I'll be working on that
2 Views