stefan hansan
02/16/2023, 6:50 PMowen
02/16/2023, 7:05 PMmy_job = define_asset_job("my_job", selection=AssetSelection.keys("my_asset")
my_schedule = ScheduleDefinition(job=my_job, cron_schedule="...")
defs = Definitions(
assets=[my_asset],
jobs=[my_job],
schedules=[my_schedule],
resources={"db_cursor": db_cursor, "requests": requests_session},
)
stefan hansan
02/16/2023, 7:19 PMowen
02/16/2023, 7:20 PMdefine_asset_job(..., config={"ops": {"my_asset": {"config": {"my_key": 1, "other_key": "value"}}}})
stefan hansan
02/16/2023, 7:25 PMowen
02/16/2023, 7:29 PMmaterialize_to_memory
instead of execute_in_process
for this use case. This has both a run_config and resources argument (so you get the added bonus of being able to mock out those resources). This would look like
from dagster import materialize_to_memory
result = materialize_to_memory([my_asset], resources=..., run_config=...)
stefan hansan
02/16/2023, 7:43 PMresult = materialize_to_memory([my_asset], resources={'resources': { {'requests_session': {'config': {'CERT': {'env': CERT}}}}}}
stefan hansan
02/16/2023, 7:44 PMowen
02/16/2023, 7:49 PMstefan hansan
02/16/2023, 8:01 PMresources= {'requests_session': requests_session_configured}
I am still getting the error 'resource with key, "requests_session" required by op x not provided' even though i think i am providing it with the above snippetowen
02/16/2023, 9:22 PM