Hi all. Is there any way of applying the `@solid` ...
# announcements
r
Hi all. Is there any way of applying the
@solid
decorator multiple times and having it "just work"? From what I can see it seems like subsequent applications override the first, or something else prevents them from working together. Use-case: we have certain config we want to apply to many solids which is standardised, but a bit verbose to type out every time (e.g. OutputDefinitions). We'd like to wrap it all into our own, standard decorator, which would apply some
@solid
config, but then we should also be able to add to that on a solid-by-solid basis when needed with an additional
@solid
decoration.
g
Hi, I would use a solid factory for this use-case: https://docs.dagster.io/overview/solids-pipelines/solid-factories#main
The generic stuff can be defined inside your solid factory and you can add other parameters as method args, to extend your factory when necessary.
s
Hi @Ryan - the configured API may be able to supply what you need: https://docs.dagster.io/overview/configuration/configured
r
Thanks Gregory and Sandy 🙂 I'm not sure if the Configured API would work, as all the examples seem oriented around manipulating the solid's
config_schema
, i.e. arguments to the underlying compute function. Ended up going with something closer to Gregory's solid factory suggestion 👍🏼 In our case it ended up looking like a thin wrapper decorator around the main
@solid
decorator itself, that just adds our standard configs to any arguments it may receive before passing everything through to Dagster to handle as normal.