{"action":"created","issue":{"url":"https://api.github.com/repos/iconara/rubydoop/issues/34","labels_url":"https://api.github.com/repos/iconara/rubydoop/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/iconara/rubydoop/issues/34/comments","events_url":"https://api.github.com/repos/iconara/rubydoop/issues/34/events","html_url":"https://github.com/iconara/rubydoop/pull/34","id":107056368,"number":34,"title":"Add ConfigurationDefinition#after","user":{"login":"jowl","id":1180277,"avatar_url":"https://avatars.githubusercontent.com/u/1180277?v=3","gravatar_id":"","url":"https://api.github.com/users/jowl","html_url":"https://github.com/jowl","followers_url":"https://api.github.com/users/jowl/followers","following_url":"https://api.github.com/users/jowl/following{/other_user}","gists_url":"https://api.github.com/users/jowl/gists{/gist_id}","starred_url":"https://api.github.com/users/jowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jowl/subscriptions","organizations_url":"https://api.github.com/users/jowl/orgs","repos_url":"https://api.github.com/users/jowl/repos","events_url":"https://api.github.com/users/jowl/events{/privacy}","received_events_url":"https://api.github.com/users/jowl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-17T19:29:14Z","updated_at":"2015-09-17T20:29:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/iconara/rubydoop/pulls/34","html_url":"https://github.com/iconara/rubydoop/pull/34","diff_url":"https://github.com/iconara/rubydoop/pull/34.diff","patch_url":"https://github.com/iconara/rubydoop/pull/34.patch"},"body":"As promised, here's a PR suggesting to add `ConfigurationDefinition#after` which would enable users to register callbacks to be run when the all jobs has finished. The callbacks are called with a boolean indicating the success of the job(s), e.g.\r\n\r\n```ruby\r\nRubydoop.run do |*args|\r\n\r\n  # job setup\r\n\r\n  after do |success|\r\n    if success\r\n      # job finished successfully\r\n    else\r\n      # job failed\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nTaking this further, you could implement similar callbacks for individual jobs and sequences thereof, but I thought I'd start simple."},"comment":{"url":"https://api.github.com/repos/iconara/rubydoop/issues/comments/141218442","html_url":"https://github.com/iconara/rubydoop/pull/34#issuecomment-141218442","issue_url":"https://api.github.com/repos/iconara/rubydoop/issues/34","id":141218442,"user":{"login":"jowl","id":1180277,"avatar_url":"https://avatars.githubusercontent.com/u/1180277?v=3","gravatar_id":"","url":"https://api.github.com/users/jowl","html_url":"https://github.com/jowl","followers_url":"https://api.github.com/users/jowl/followers","following_url":"https://api.github.com/users/jowl/following{/other_user}","gists_url":"https://api.github.com/users/jowl/gists{/gist_id}","starred_url":"https://api.github.com/users/jowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jowl/subscriptions","organizations_url":"https://api.github.com/users/jowl/orgs","repos_url":"https://api.github.com/users/jowl/repos","events_url":"https://api.github.com/users/jowl/events{/privacy}","received_events_url":"https://api.github.com/users/jowl/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T20:29:23Z","updated_at":"2015-09-17T20:29:23Z","body":"@iconara commented on the error handling in the callbacks in my previous PR, but I forgot about it. It's fxed now though.\r\n\r\nThe latter idea might be good, even if I don't know how much useful info you could extract from a `Job` instance. The problem with implementing it is that there's no way of knowing which job failed from the `ConfigurationDefinition`, as it only has a reference to the `Context`, which in turn has a reference to a job stack, which has references to all the `Job` instances. One would have to thread the failing job all the way back out to the `ConfigurationDefinition`, either via `#wait_for_completion` or a new accessor `#current_job` or similar, to get it to work. It would probably be interesting to know whether the job was killed or failed from the state though."}}