lhupfeldt / jenkinsflow

Python API with high level build flow constructs for jenkins/hudson
BSD 3-Clause "New" or "Revised" License
13 stars 4 forks source link

Flow callback function #20

Open lechat opened 10 years ago

lechat commented 10 years ago

Hi, Lars,

Another suggestion: I have lenghty subflow, and I want to send email once that flow have finished. If I add email function inside with serial(...) - it will be called right when flow is parsed. So I have to make send_email job and call it from flow. Kind of inneficient.

What I suggest is to have an ability to register callback functions with the flow:

with serial(...) as main_flow:
    main_flow.on_success(some_callable)
    main_flow.on_failure(some_other_callable)
    main_flow.invoke('job1')

That way I don't have to do a separate job and can do interesting things from the same script.

Thanks!

Aleksey

lhupfeldt commented 10 years ago

Hi Aleksey,

That was on my own wishlist for a long time but other featuress keep creaping in in front of it. The 'message' method is a little similar (although it does not accept a callback)