Skip to content

Handling failures is extremely inconvenient for complex jobs #47

Closed

Description

@Nopik

Lets assume that there is a job which runs one task:

- task: task1
  file: foo/task1.yml

and we have some resource sending out notifications about success or failure (e.g. via email or slack). It goes like this (assuming that resources are configured):

- task: task1
  file: foo/task1.yml
- aggregate:
  - conditions: [success]
    put: email
    params:
      text: Success!
  - conditions: [failure]
    put: email
    params:
       text: Failure!

That already is increase from 2 lines to 11. Now, lets suppose that we have 2 tasks running inside job:

- task: task1
  file: foo/task1.yml
- aggregate:
  - conditions: [success]
    name: task1-succeeded
    do:
    - task: task2
      file: foo/task2.yml
    - aggregate:
      - conditions: [success]
        put: email
        params:
          text: Success!
      - conditions: [failure]
        put: email
        params:
           text: Failure!
  - conditions: [failure]
    put: email
    params:
       text: Failure!

Which is 21 lines. Adding 3rd and 4th tasks would be overkill.

I'm looking for try / catch / finally kind of approach, where one could add just one error handler at the end or something like this.

Activity

  1. vito commented on Jul 16, 2015

    @vito
    Contributor

    As of 0.57, we have replaced conditions with a hook-based approach:

    http://concourse.ci/on-success-step.html
    http://concourse.ci/on-failure-step.html
    http://concourse.ci/ensure-step.html

    This allows you to reduce those to...:

    - task: task1
      file: foo/task1.yml
      on_success:
        put: email
        params:
          text: Success!
      on_failure:
        put: email
        params:
           text: Failure!

    ...and...

    - do:
      - task: task1
        file: foo/task1.yml
      - task: task2
        file: foo/task2.yml
      on_success:
        put: email
        params:
          text: Success!
      on_failure:
        put: email
        params:
           text: Failure!

    (note the use of do to wrap all steps in the hooks)

    A later iteration that may be nice is to be able to attach these hooks to the job itself, which would allow you to remove the additional do nesting. Which would be nice if they're hooks that're truly added to every single job (as alerting services tends to be) where having the additional nesting gets old quick.

  2. concourse-bot commented on Jul 21, 2015

    @concourse-bot

    Hi there!

    We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.

    The current status is as follows:

    • #99488414 Handling failures should be less painful for complex jobs

    This comment, as well as the labels on the story, will be automatically updated as the status in Tracker changes.

  3. concourse-bot commented on Jul 21, 2015

    @concourse-bot

    Hello again!

    All stories related to this issue have been accepted, so I'm going to automatically close this issue.

    At the time of writing, the following stories have been accepted:

    • #99488414 Handling failures should be less painful for complex jobs

    If you feel there is still more to be done or have any questions, feel free to reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions