The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Does ScriptRunner Cloud guarantee script execution order?

Andrew Lipscomb
Contributor
November 29, 2016

Say on a Post Function list I have 3 different scripts that do different things based on different execution conditionals, and would ideally be kept separately due to their use elsewhere in the system (if someone commits to the master backups its more work to merge into one megascript)

Lets call these Scripts A, B and C (in that order in the Post Function operation list)

 - Are they guaranteed to execute in that order (A->B->C)?

 - Will B execute before A is finished? Can/should B rely on possible changes made by A or assume randomness?

 - If B was to Transition an issue (thereby triggering other automation on a different Post Function routine) will C be run? If C was to run, will it fail due to outdated Transition data passed to the script?

 

The joys of an async environment smile 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

9 votes
Answer accepted
Jon Mort _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 30, 2016

Hi Andrew,

The short answer is no. You can't rely on any ordering for post functions and scripts will be executed in parallel. JIRA fires off the webhooks that cause the scripts to be executed in the order they appear in, but it does not wait for the webhook to complete before sending the next.

We have some ideas around guaranteed ordering of post functions, such as having a list of scripts that execute as one post function, but nothing concrete as yet.

Regards, Jon

Andrew Lipscomb
Contributor
November 30, 2016

So;

Are they guaranteed to execute in that order (A->B->C)? => Yes, JIRA respects the Post Function ordering

Will B execute before A is finished? Can/should B rely on possible changes made by A or assume randomness? => No; guarantees aren't there. Assume unreliable states if multiple scripts are modifying the same fields

If B was to Transition an issue (thereby triggering other automation on a different Post Function routine) will C be run? If C was to run, will it fail due to outdated Transition data passed to the script? => Yes, C will be run as its part of the Post Function op routine. Again assume unreliable states

Correct? Its basically what I expected, but good to confirm. 

Aristedes Maniatis
Contributor
November 30, 2016

Is this also true for script listeners? That is, they run in parallel?

Jon Mort _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 30, 2016

Andrew: Yes if I understand correctly your scenario you're correct.

Aristedes: Yes they are run in parallel