Riccardo Tesselli
06/27/2023, 12:00 PMfrom dagster import asset, failure_hook, Definitions, define_asset_job
@asset
def my_asset():
return 1
@failure_hook(required_resource_keys={'my_resource'})
def my_hook(context):
print("hello hook")
definitions = Definitions(
assets=[my_asset],
jobs=[define_asset_job("my_job", selection='my_asset', hooks={my_hook})],
resources={
'my_resource': None
}
)
When I run Dagit then I get:
dagster._core.errors.DagsterInvalidDefinitionError: resource with key 'my_resource' required by hook 'my_hook' attached to job 'my_job' was not provided. Please provide a <class 'dagster._core.definitions.resource_definition.ResourceDefinition'> to key 'my_resource', or change the required key to one of the following keys which points to an <class 'dagster._core.definitions.resource_definition.ResourceDefinition'>: ['io_manager']
This error does not happen when instead of creating the job from an asset, I create it from a graph via the <http://graph.to|graph.to>_job
method.
I’m running on dagster 1.3.11Riccardo Tesselli
06/27/2023, 12:01 PMsean
06/27/2023, 1:59 PMRiccardo Tesselli
06/27/2023, 2:12 PMBrian Githinji
06/27/2023, 2:22 PMsean
06/27/2023, 2:23 PMRiccardo Tesselli
06/27/2023, 2:25 PMdefine_asset_job
accepts hooks now, before it didn’tBrian Githinji
06/27/2023, 2:27 PM