DagsterDocs

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_message_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_message_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()
class dagster.HookDefinition(name, hook_fn, required_resource_keys=None)[source]

Define a hook which can be triggered during a solid execution (e.g. a callback on the step execution failure event during a solid execution).

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

  • hook_fn (Callable) – The callback function that will be triggered.

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