Async Actions and Action List Properties

FB 5.5

Short Q's:

  1. Are action list parameters stored globally or is there a separate instance of the parameters for each action list if run multiple times in an Async Action Group?

  2. Can an action list parameter be passed to a project variable in a project that the action list includes? I'm having trouble getting this to work (see below).

More Info:

I run an automated build to compile several apps within a source control branch every half hour but as I now have multiple source branches building them sequentially takes longer than half an hour. Running them asynchronously would improve things quite a bit (many of the actions are CPU or network bound).

I want to be able to build more than one branch simultaneously using an Async Action Group. It would be great to have async iterators (in my case the INI File iterator as an INI file lists which branches to build). I know that's on the to-do list.

I have a couple of action lists for re-use and have created an Async Action Group containing one child action for each branch (it's more complex than that as the number of branches cannot be pre-determined, there could be many, so I have a set of 20 Run Action List child actions and they figure out which branch they need to build if any - but this is essentially what happens). Here's a conceptual overview:

Main Project
Main Action List
- Async Action Group [max threads=2]
-- Run Action List BuildBranch (set branch_name=A)
-- Run Action List BuildBranch (set branch_name=B)
-- Run Action List BuildBranch (set branch_name=C)
-- Run Action List BuildBranch (set branch_name=D)
BuildBranch Action List (parameter: branch_name)
- Do some stuff
- Run Action List Build (set branch_name=%branch_name%)
Build Action List (parameter: branch_name)
- Include Project CommonBuildConfig (set branch_name=%branch_name%)
- Do a lot of other stuff

CommonBuildConfig Project (project variables: branch_name, aaa, bbb, ccc)
Main Action List
- Get some info based on %branch_name%
- Set variables aaa, bbb, ccc (passed back to host project)

Question: If the BuildBranch and Build action lists get run asynchronously can the value of their branch_name parameter be different for each instance of each action list?

Problem: The action lists successfully set the branch_name parameter of the action lists they call but the BuildActionList is not able to pass the value of its branch_name parameter to the branch_name variable in the CommonBuildConfig project. Here are the properties for the Build Action List's Include Project CommonBuild action:
- Reload environment variables: checked
- Share host project variables namespace: checked (might have to re-think how to pass back variables as this project is run asyncrhonously)
- Set variables before loading: branch_name to %branch_name%

I am able to set project properties in included projects in cases where I am not sharing the host project variable namespace. Is sharing the variable namespace preventing the setting of the included project's variable?

Cheers,
Jarrod Hollingworth

Hi Jarrod

A1 - Each instance of an Action list has it's own instance of the parameters collection.

A2 - Yes

You should be able to pass the correct information to included projects, however if you are calling them from an async group then you should turn off "Share host project variables namespace" option otherwise things might go a bit weird". Notice when turn off that option the label below it changes as the behavior changes too. You do need to have the variables you want to set defined in the included project (thats a common mistake that people make).

Action List Parameters can be used just like any other variable.. in fact they act like local (to the actionlist) variables so you can even set them. One thing you should make sure is that your Action list Parameter names are not the same as any project variable names.. action list parameters have a higher precedence than project variables but they are not retained when the action list completes.

If I've misunderstood anything in your post then send your projects to us at  - support at finalbuilder dot com - and I'll take a look and see what is happening.

 

Thanks Vincent. I was hoping for the two answers that you gave. A2 doesn’t appear to work though with the conditions that I mentioned (no variable build_name in main project, only defined as parameters in action lists, variable build_name is defined in included project and is set from the host project in the action lists include project action). When I debug and step into the included project the build_name variable still has its default value (some text that says to set it from the host project). I know that setting a project variable works in other cases where we don’t share the variable namespace so that might be the clue.

You’re right about the shared namespace. I need to disable that so the fact that it doesn’t work now doesn’t matter as I need a different way to pass back variables. What are some other easy ways to pass a few variables back from the included project to parameters in the action list that included the project? (Need to be actionlist parameters to have different values for each instance). I guess the included project could write an INI file that the action list in the host reads on return.

Cheers,
Jarrod Hollingworth

Hi Jarrod

Send us your projects and I’ll take a look. It should work as you described. As for passing values back, if you are not sharing the variable namespace (which doesn’t make sense when running multiple instances) then you need use some external storage such as an ini file.