Is there a way for the input to a `solid` to have ...
# announcements
Is there a way for the input to a
to have a default value? e.g.
Copy code
def some_solid(context, x, y=1.0):
    do_something(x, y)
Related question, is there a way to set the value for a solid in config so that aliases of the solid inherit that value?
Yes and no. You can set default values for solid inputs but not in the function signature like you did. You would need to do that via a config field. The reason we want to defer eveything to the config in the solid decorator is because it gives you a lot of nifty features when you execute pipelines via dagit and also because your pipelines are much more mantainable when there is a single source of truth for pipeline configuration. Imagine a world where you have a pipeline with 500 solids and this one solid has a default parameter that tweaks things in a subtle way, it would be nice to have all of your knobs and dials in one config so that you can grok it to figure out what is going on when something goes wrong or when you inevitably try to shim a new solid into that pipeline. Here is more info on our config system: And to directly give you code to answer your question, here is an example of how I used defaults:
RE the second question. I am afraid I don't quite understand. Could I get an example of what you mean by "setting the value for a solid in config"?
Thanks for the reply. You’re right, the second question was unclear. I was getting at the following: Say I have a solid that applies some transformation to my data:
Copy code
def do_transformation(context, data, transformation_parameter):
    return transformation_parameter * data
In this case the solid just multiplies my data by a constant. I might need to apply the exact same transformation (with the same value of
to more than one value of
. In dagster, that would be achieved with aliasing:
Copy code
def some_pipeline():
    # upstream stuff
    result_a = do_transformation.alias('do_transformation_a')(data_a)
    result_b = do_transformation('do_transformation_b')(data_b)
I can stub a value for the
input in a yaml file, but I have to separately stub for the two aliased solids:
Copy code
        value: 5
# etc
What I’d like is a way to set a single value for
in my yaml that is applied to both
That’s a great question. So I think configs take care of this for you. If you plan on having a value stay the same across all of your aliased solids you should just make it a default argument in the solid config then you don’t need to specify it at all in your environment config
However if you plan on it changing then sadly you will have to specify it as a config variable for each solid because it’s not a default
Composites solids, our means of composition, have some tools that my allow you to solve the problem you are facing. You can use them to manipulate the config for their inner solids - such as binding fixed values or mapping a single config field to multiple places. docs: example: