Network Automation Software
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Shared Variable Behavior
Topic Summary:
Created On: 07/26/2011 09:14 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 07/26/2011 09:14 AM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

I have created a very basic workflow, that contains another workflow.  In both the parent and child workflows, I have defined shared variables of the same name, for the purpose of passing values to the child workflow (a running total of execution time that it will update) and receiving values from the child workflow back in the parent (any error information and the running total for execution time).  While in the child workflow, the shared variables are properly referenced and updated.  However, once back in the parent workflow, some of the shared variables are a) either being wiped out/re-initialized (not to the inital value, however - just to empty), or the values are being jumbled/switched between the variables.  ie: variable #2 and variable #6 values are switched, #3 and #5 are switched, etc.

Here are some additional notes:

I have a total of 6 shared variables

They are defined in the same order in both the parent and the child workflow

I have tried making the variable types both Auto and value specific (number/text)

If I remove shared variables (to where I only have 1), and then add them back, the behavior returns.

I have tried renaming the variables

I have tried all the combos of 'treat as parameter' vs not, defined locally as well vs. not, etc. that I can think of.

Any insight would be greatly appreciated! 



 Category Survey
 07/26/2011 04:13 PM
User is offline View Users Profile Print this message

Author Icon
Rick Johnson
AUTOMATE EMPLOYEE

Posts: 2757
Joined: 07/14/2008

Hi Deborah,

When I test this type of scenario, there are not unexpected results.

Can you export the workflow in question and attach it to a reply to this post so I can analyze it?

 Category Survey


-------------------------
- Rick Johnson
Network Automation
 07/27/2011 05:26 AM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

Rick -

Thanks so much for taking a look.  I have attached the exported workflow.  This is the second workflow that I have started that I have experienced this in, fyi. 

Thanks!

Deborah.



 Category Survey
 07/27/2011 01:16 PM
User is offline View Users Profile Print this message

Author Icon
Rick Johnson
AUTOMATE EMPLOYEE

Posts: 2757
Joined: 07/14/2008

Hi Deborah,

I see what you have been encountering now. i think my testing did not reveal this behavior as my sybworkflow was updating the shared vars, where yours does not.
The behavior yuou encountered is a bug, and the usual workaround is to define the shared variable list exactly the same, with the same sequence on both the parent and child workflow.
If your sub workflow does not use those variables, it should be safe to remove them from the sub workflow's shared variables.

If you are not able to work around the issue, it has been resolved in version 8.

 Category Survey


-------------------------
- Rick Johnson
Network Automation
 07/28/2011 07:11 AM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

Rick -

Thanks for the explanation.  The intent of the 'unused' shared variables in the sub workflow was to pass back error information to the parent where the common Error Handling task resided.  Therefore, if there wasn't an error in the sub workflow, some shared variables would not be assigned any values there.  But they need to remain defined in the sub workflow in the event an error is encountered.

For the record, I tried changing my script to modify all the shared variables in the sub workflow, and the same ones are still getting jumbled.  I am punting for now until we upgrade...

I am, however, very glad to hear that a) it has been addressed in version 8 and b) I am not crazy!  Being new to AutoMate, I wasn't sure about the latter. 

Thanks so much,

Deborah.



 Category Survey
 07/28/2011 07:18 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Deborah,
in the meantime, as a workaround, it could be safe to always update all shared variables in the subworkflow.
This could be done at the very beginning of the subworkflow, by assigning all of them their own current value, which would be transparent to the rest of the workflow.

 Category Survey


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 07/28/2011 07:57 AM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

Jean -

Thanks so much - I will give that another try!

Deborah.



 Category Survey
 07/28/2011 11:23 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Deborah,
I tried your workflow, and somehow added some markers on it, so that the problem is better evidenced.
In fact the problem lies in invoking the WrapItUp task.
This tasks gets the SharedVars wrong, while they are still correct in the Workflow.
And when WrapItUp ends, it returns the messed up SharedVars into the Workflow.
Hereunder a picture of the situation during the "WrapItUp" execution :
the SharedVars are still correct in the workflow, but are wrong in the "WrapItUp"

I tried adding in "WrapItUp" declaration of the variables as parameters, and assigning new identical values, but nothing improved the mess. This is definitely a bug without a workaround.

 Category Survey


Click for full image
Click for larger image
MainFlow.ampkg.txt
MainFlow.ampkg.txt  (12 KB)



-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 07/28/2011 12:23 PM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

Jean -

Thanks so much for confirming what I am still seeing as well.  It does seem to be related to executing a task after returning from the execution of the sub workflow.  I have been able to reproduce the problem several times from workflows and tasks that I have started from scratch.  I hope this scenario has indeed been addressed in version 8.  While I am still familarizing myself with AutoMate and its infinite possibilities, I was attempting to see if I could standardize an error handler task for any workflow (with or without a subworkflow), as well as a run statistics/log type task for summarization at the end.

Might I also add that while I am new to this site, it is evident from my poking around that you are indeed one of the 'Supreme Gurus'!  Thanks so much for looking at this further.

Deborah.



 Category Survey
 07/28/2011 10:42 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Deborah,
I installed your AMPKG into my BPA8 and it works nicely, without mixing up the Shared vars.
For migration I had to install the Migration patch that support makes available to you upon request only.

 Category Survey


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 07/29/2011 05:31 AM
User is offline View Users Profile Print this message

Author Icon
DeborahWells
Journeyman (50-99)

Posts: 63
Joined: 07/19/2011

Jean -

That's great news.  Thanks so much!

Deborah.



 Category Survey
Statistics
18257 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 6686 on 11/01/2020 at 01:24 AM.
There are currently 900 guests browsing this forum, which makes a total of 900 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog