this is probably one of those things that has been...
# dagster-feedback
s
this is probably one of those things that has been thought about a lot, and there's no good solution, but i would love for there to be a more concise way to specify config parameters. Configuring a parameter for the simplest possible op requires four levels of nested config, and while I am used to it now, it still feels heavy to me at times. Current
Copy code
@op(config_schema={"message": str})
def print_something(context):
    print(context.op_config["message"]

default_config = {
    "ops": {
        "print_message": {
            "config": {
                "message": "foo"
            }
        }
    }
}

@job(config=default_config)
def print_message_job():
    print_message()
what i was expecting when i first started was something where op config was a sort of "primary" config, and everything else was secondary, something like:
Copy code
@op(config_schema={"message": str})
def print_something(context):
    print(context.op_config["message"]

default_config = {
    "print_something.query": "select 1"
}

@job(op_config=default_config):
def print_message_job():
    print_message()
1
it's definitely one of those situations where explicit is better than implicit, and once you're used to it, it makes sense. hesitated to even post something, but I wanted to throw it in here as feedback in case it resonated with anyone else, and because adding big blocks of yaml or dict config takes you out of the "writing python" experience that i think dagster promotes
z
it's definitely not a perfect solution but I've found that a config mapping can really help simplify writing configs for a job. it's really only helpful when the interface has stabilized, and feels like a lot to have to add for simple jobs - that being said it's super flexible.
❤️ 1
s
yeah, i keep meaning to look into this. wonder if i could write a config mapping generator that takes an op definition and outputs a config along the lines of what i wrote above... hmmnod
z
lol I was just thinking the same thing!
s
@Stephen Bailey -
configured
might be useful here:
Copy code
@op(config_schema={"message": str})
def print_something(context):
    print(context.op_config["message"]

default_config = {
    "message": "hello"
}

@job
def print_message_job():
     print_message.configured(default_config)()
🤔 1
s
interesting, haven't used
configured
for ops yet, only for resources. i was able to get an _almost_ MVP of what I was thinking put together using a config_mapping generator. there's an issue with mapping the input to config, just don't have the time to fix it. 🤷