How to do conditional threaded steps
Here is what I want to do:
I have two environment variables control the steps. One as this format "y,y,n,n", the other "server1, server2, server3, server4". In this example, I need to run the program (has a few steps not only one) on server1 and server2, because the first two are set to "y".
Now I want to have something like this in BF steps:
1. Loop through "y,y,n,n", if it's "y" then run the program on the corresponding server. If there are multiple "y", run them in a separated threaded step (note there are multiple steps, not only one).
2. When all done, join the threaded steps and return error if anyone fails (how to join the result?)
How to implement this?
Thanks
Jirong
|
One answer
You might want to use a selector instead. You can put a collector on the agents to get the information you want and then make a selector to select on that criteria. Then run the step threaded with broadcast.
To do it strictly as you have laid out you would have to do something with .run and conditionals steps.
~Spencer Comments
Jirong Hu
commented Jun 23 '15, 11:18 a.m.
I am using selector BF_NAME=<server_name> to select a server, but never used collector before. Do you mean 1) I create a collector on these servers, e.g. tag=1 on server1, and tag=2 on server2, etc. 2) then in the previous step, I set the tag value, eg. tag=1 and broadcast the step, and it will select the server with tag=1 to run.
Jirong Hu
commented Jun 23 '15, 11:43 a.m.
We have lots of servers, we just need to tag the server wants to receive the command, not everyone, right? Exactly. You can tag servers in the collector to create new pools of agents to choose from. Then you can select by that tag in the selector. Tagging is pretty basic, but you can get more sophisticated by adding more criteria to the collector and then selecting more specific subsets of the agents.
Jirong Hu
commented Jun 24 '15, 4:29 p.m.
There is so little information about how to actually do it. https://jazz.net/help-dev/rational-automated-framework/index.jsp?topic=/com.ibm.rational.buildforge.doc/topics/about_bf_objects.html
Can you tell me step by step how to achieve it?
Thanks
Jirong
Jirong Hu
commented Jun 24 '15, 9:04 p.m.
@Spencer Murata, can you tell me how to tag the server?
Spencer Murata
commented Jun 25 '15, 9:37 a.m.
| edited Jun 25 '15, 9:37 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Create a new collector named TAG1 and save it off.
Then create a new variable in that collector named TAG with a value of 1
Assign the collector to the agent you want to tag as 1 in the Server menu
Then create a new selector SELECT_TAG_1
Set the standard property variable. You should see that TAG is available now as a value. Set it to 1.
The selector will now select server that is tagged with TAG=1.
Note that the collectors can be used with include to create nested collectors assembled from other collectors.
~Spencer
showing 5 of 6
show 1 more comments
|
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.