Does ScriptRunner Cloud guarantee script execution order?

Andrew Lipscomb 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

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 Leaders.
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 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 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 Leaders.
November 30, 2016

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

Aristedes: Yes they are run in parallel

Suggest an answer

Log in or Sign up to answer