It's all about the answers!

Ask a question

Run the fail chain when a job gets canceled?


Martina Riedel (20323341) | asked Mar 19 '14, 7:53 p.m.
BF 7.1.2

I have a long running job that on its way gathers some data and at the end emails it.
Every so often there is a valid reason to cancel it.
I'd still like to "summarize" the data gathered so far and preferably send the email.
Is there any way to run the fail chain when a project gets canceled?

Accepted answer


permanent link
Ryan Ruscett (1.0k413) | answered Mar 19 '14, 9:02 p.m.
 Hello,

Unfortunately there isn't. You could use conditional statements and in the else statement specify what to do if the command fails. You could try log filters etc. But if you manually cancel the job. There is no way for it to run a "clean up" of data when the cancel button is clicked.

Now if you have a step or a few steps you can single out. You could use log filters and conditional steps to.. Well for example:

If X happens I want to go cancel the job. Well if that step where X happens is conditional. You can set the log filter to "stop build with warning results" or "stop build with fail results" Based on what X does. Then the else will run right away and kick off another project that gathers data or sends an email notation. 

You could also try Trigger variables (Link Below)

There really isn't a way to take an existing project and make this type of thing happen easily without re-architecture type changes. But if you are willing to do that it's possible. Here are some links to help understand what all the options are for log filters etc. 

Controlling Execution Flow
http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m2/topic/com.ibm.rational.buildforge.doc/topics/steps_exec__top.html?resultof=%22else%22%20%22els%22%20%22command%22%20 

Conditional Step Execution
http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m2/index.jsp?topic=%2Fcom.ibm.rational.buildforge.doc%2Ftopics%2Fsteps_exec_conditional.html

Trigger Variable Reference
http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m2/index.jsp?topic=%2Fcom.ibm.rational.buildforge.doc%2Ftopics%2Fenv_variable_triggers_reference.html


Sorry there isn't anything more concrete. Build Forge can in my experience (which is a lot) do whatever you want. Just depends on how creative you want to get. The beauty is you do it once and it works forever!!! So it's usually worth it!

Thanks!
Martina Riedel selected this answer as the correct answer

Comments
Martina Riedel commented Mar 20 '14, 9:15 a.m.

Thanks, that's what I thought.


Robert haig commented Mar 20 '14, 10:38 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

actually it is possible to do what you want, but not through fail chains. See below.

One other answer



permanent link
Robert haig (1.0k16) | answered Mar 20 '14, 10:46 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
 You can accomplish this through a class entry chain.

Look in the class section, and you'll see that you can define a project to run on entry and on exit.  What this means, is that when you change the class of a completed job, it will spawn a chain build of the specified project that inherits the environment of the project whose class you just changed.

Example:  Your long running project has gathered most of it's data, and you needed to cancel it.  After canceling the job, you can change it's class from the job page and the chained project would then interrogate the environment of the parent job to get the information it needs to email to you.  For this to work nicely, you either need to store all of the information in environment variables or store a pointer to the information in an environment variable.  In this case, I would choose the latter solution, and likely store a path to a file in a variable that I would access and email after.

This feature is closely related to purge chains that start when a build is purged (perhaps to clean up artifacts that the BF DB might not know about) and is configured in the same place.  

Comments
Martina Riedel commented Mar 20 '14, 1:11 p.m.

This is a very cool option as well. Lots to think about.
Thanks

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.