Hooks

@dagster.success_hook(name=None, required_resource_keys=None)[source]

Create a hook on step success events with the specified parameters from the decorated function.

Parameters
  • name (Optional[str]) – The name of this hook.

  • required_resource_keys (Optional[Set[str]]) – Keys for the resources required by the hook.

Examples

@success_hook(required_resource_keys={'slack'})
def slack_on_success(context):
    message = 'solid {} succeeded'.format(context.solid.name)
    context.resources.slack.send_message(message)

@success_hook
def do_something_on_success(context):
    do_something()
@dagster.failure_hook(name=None, required_resource_keys=None)[source]

Create a hook on step failure events with the specified parameters from the decorated function.

Parameters
  • name (Optional[str]) – The name of this hook.

  • required_resource_keys (Optional[Set[str]]) – Keys for the resources required by the hook.

Examples

@failure_hook(required_resource_keys={'slack'})
def slack_on_failure(context):
    message = 'solid {} failed'.format(context.solid.name)
    context.resources.slack.send_message(message)

@failure_hook
def do_something_on_failure(context):
    do_something()