mode definitions with schema #3385
-
Hello, I'm trying to create static mode definitions with configured resources. Perhaps I'm using the API incorrectly, but I basically wish to have a dev mode and a prod mode, with resources defined for each. What I'm unsure about is how to pass in the # pipeline mode definition
mode_development = ModeDefinition('dev', resource_defs={
'service_one': configured(
http_resource, config_schema={
'host': String('127.0.0.1'),
'port': Int(8080),
}
),
'service_two': configured(
http_resource, config_schema={
'host': String('127.0.0.1'),
'port': Int(8888),
}
),
})
# solid
@solid(required_resource_keys={'service_one'})
def my_solid(context: SolidExecutionContext):
yield Output(1, output_name='number') The problem is that once we get to the solid, it raises:
What's the preferred approach to configuring Thanks! EDIT: correct usage of String/Int |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I have answered my own question. Specifically, a call to the resource's # pipeline mode definition
mode_development = ModeDefinition('dev', resource_defs={
'service_one': http_resource.configured({
'host': String('127.0.0.1'),
'port': Int(8080),
}),
'service_two': http_resource.configured({
'host': String('127.0.0.1'),
'port': Int(8888),
}),
}) Edit: Correct usage of String/Int |
Beta Was this translation helpful? Give feedback.
-
Hi @ahoneycutt! 👋 Thanks for sending over this question. We're working on adding "How-to" guides to our docs and I just added this question to the list. We would love to hear feedback you have about dagster or about "How-to" guides you would like to see, either via GH Discussions or on Slack :) |
Beta Was this translation helpful? Give feedback.
I have answered my own question. Specifically, a call to the resource's
configured
method is appropriate here. See https://docs.dagster.io/overview/configuration/configured#main for more information.Edit: Correct usage of String/Int