Danny Steffy
03/06/2023, 7:03 PMDanny Steffy
03/06/2023, 7:06 PMDanny Steffy
03/06/2023, 7:30 PMgraph_asset = AssetsDefinition.from_graph(
full_scored_data_set,
keys_by_input_name={
"recruiter_teams_to_score": AssetKey("recruiter_teams_to_score"),
"trained_model": AssetKey("trained_model"),
},
resource_defs={
"merge_sproc_io_manager": sql_merge_sproc_io_manager.configured(
{
"sproc_name": "xxxx",
"db_name": "xxx",
}
)
},
)
but because of the way our project is set up, I can't seem to access that custom IO manager in my assets folder. Is there some way to get that resource definition from dagster's context so I can configure it?Danny Steffy
03/06/2023, 9:25 PMDanny Steffy
03/06/2023, 10:05 PM@graph
def full_scored_data_set(recruiter_teams_to_score, trained_model):
"""score all recruiters"""
ingest_configured = configured(ingest_data_and_score, name="ingest_configured")(
"'outputs': {'result': {'sproc_name':'xxx','db_name': 'xxxxx',}}}}}}}"
)
result = (
key_to_score(recruiter_teams_to_score)
.map(
lambda key: ingest_configured(
recruiter_in_batch=key, trained_model=trained_model
)
)
.collect()
)
return append_scores(result)
Danny Steffy
03/06/2023, 10:05 PMMissing required config entry "ops" at the root. Sample config for missing entry: {'ops': {'full_scored_data_set': {'ops': {'ingest_configured': {'outputs': {'result': {'db_name': '...', 'sproc_name': '...'}}}}}}}
Danny Steffy
03/06/2023, 10:05 PMDanny Steffy
03/07/2023, 3:22 PMchris
03/07/2023, 7:17 PMDanny Steffy
03/07/2023, 7:23 PMhandle_output
, yeahchris
03/07/2023, 7:27 PMDanny Steffy
03/07/2023, 7:30 PMchris
03/07/2023, 8:23 PMDanny Steffy
03/07/2023, 8:36 PMhandle_output
?chris
03/07/2023, 8:37 PMOutput
instance, fill out the metadata arg, then in handle_output
it should be available on output_context.metadata
chris
03/07/2023, 8:39 PM@op
def my_op():
return Output("foo", metadata={"db": "users-table"})
and then in your io manager:
class MyIOManager(IOManager):
def handle_output(output_context, obj):
if output_context.metadata["db"] == "users-table":
...
does that fit your use case / make sense?Danny Steffy
03/07/2023, 8:40 PMDanny Steffy
03/07/2023, 9:21 PMchris
03/07/2023, 9:22 PMcontext
I probably misremembered the default arg nameDanny Steffy
03/07/2023, 9:22 PMcontext.metadata
and I got a key errorDanny Steffy
03/07/2023, 9:27 PMcontext.metadata["db"]
returned a key errorchris
03/07/2023, 9:29 PM@op(out=Out(metadata={...}))
def my_op():
return whatever
Danny Steffy
03/07/2023, 9:30 PMDanny Steffy
03/07/2023, 9:37 PMDanny Steffy
03/07/2023, 9:38 PMDanny Steffy
03/08/2023, 5:38 PMload_input
side of the IOManager? And if so, would I just need to provide the metadata as an In
in the downstream op to send it correctly?chris
03/08/2023, 5:57 PMDanny Steffy
03/08/2023, 6:09 PMDanny Steffy
03/08/2023, 6:09 PMout=Out(
io_manager_key="sql_merge_sproc_table",
metadata={
"db_name": "xxxx",
"sproc_name": "MergeDagsterJson_ProbabilityRecruiterLikeAthleteGivenProfileView_RunStats",
"schema_name": "dbo",
"table_name": "ProbabilityRecruiterLikeAthleteGivenProfileView_RunStats",
},
),
chris
03/08/2023, 6:09 PMDanny Steffy
03/08/2023, 6:09 PM