Note: This section of the tutorial can only run on Polyaxon EE and Polyaxon Cloud.

Hooks are a simpler abstraction compared to a DAG. It allows to trigger post-done operations, like sending notifications or triggering a logic in response to the final state of an operation. You can use any component as a hook, as long as it’s registered in the public component hub or in a private hub in your organization.

Using the public components

Polyaxon provides several public components where the main purpose is to be used as a hook, like notifiers. For instance you can notify a slack channel about the state of your jobs:

hooks:
  - trigger: succeeded
    hubRef: slack
    connection: slack-notification

If you need to send notifications for all done statuses:

hooks:
  - trigger: done
    hubRef: slack
    connection: slack-notification

Running multiple hooks

It’s also possible to have multiple hooks or the same hook based on different conditions, for instance, a user can both send a slack notification and start a tensorboard after a successful experiment:

hooks:
  - trigger: succeeded
    hubRef: tensorboard
    disableDefaults: true
    params:
      uuid: { value: '{{ globals.uuid }}' }
  - trigger: succeeded
    hubRef: slack
    connection: slack-notification