Peter Lim
03/06/2024, 4:57 PMScout
03/06/2024, 4:57 PMdefine_asset_job
and using op_tags
to dictate the behavior of the hook. This is considered a workaround and not the preferred behavior. Here is an example from a Github issue where a user shared their workaround: python @success_hook def slack_message_on_success(context: HookContext): if context.op.tags.get("success_message"): message = ( f"{context.op.name} with tags {context.op.tags} in job {context.job_name} succeeded." ) <http://context.log.info|context.log.info>(message) @asset( op_tags={"success_message": True}, ) def my_asset(): ...
This approach uses the op_tags
to pass information to the hook, but as the user mentioned, it is a hacky solution. Another related issue discusses the possibility of defining post-run hooks on asset jobs, which indicates that this is a feature that users are interested in, but it may not be currently available in a straightforward manner. If you are looking to implement hooks for asset materialization, you might need to consider similar workarounds or keep an eye on the progress of these feature requests in the Dagster Github repository. For the most up-to-date information and potential new features, you should refer to the latest Dagster documentation or check for updates on the Github issues and discussions.