Automic Workload Automation

 View Only

 External Dependency - Wait if Currently Running?

MatthewA's profile image
MatthewA posted Mar 19, 2025 09:27 AM

We have a workflow with an external dependency.  This external dependency runs every couple of hours.  We are using the "after the last workflow execution end" option.  Is there a way to tell the workflow to wait if the external dependency is currently in a running state?  We don't want these two processes to conflict with each other.  We also don't want to use the "after this workflow start" option because we don't want to hold up the workflow in case the other team has to pause their external dependency process for a period of time.  Is there a best practice for this?  Thanks.

Joel Wiesmann's profile image
Joel Wiesmann

Hi Matthew

You can use a SYNC object to prevent two objects with different names to run at the same. The logic can be built in a way, that one object would wait for the other to end.

https://docs.automic.com/documentation/webhelp/english/AA/24.4/DOCU/24.4/Automic%20Automation%20Guides/Content/AWA/Objects/obj_Sync.htm

Regards
Joel

MatthewA's profile image
MatthewA

Hi Joel, thank you for responding.  For the sync object option, I'm assuming that the other team would have to modify their external dependency to use that sync object?  Can you think of another way to achieve this without having to go that route?  Is it possible to use a Precondition in the workflow perhaps that would check the running state of the external dependency process?

Joel Wiesmann's profile image
Joel Wiesmann

Hi Matthew

You don't use external dependencies anymore in sync - scenarios.

  • Use external dependencies, if your solution depends on another solution. 
    Example: Workflow 1 creates a file, workflow 2 must process the file. There is a clear order.

  • Use sync objects, if your object must not run at the same time like another object.
    Example: Workflow 1 and workflow 2 manipulate data. The order of their execution does not matter but they must not run at the same time, as this could cause data corruption or performance issues.

The use of sync objects requires that the objects involved are changed so that they change/read the state of the sync object.

If you were to implement precondition checks, you would have to implement them in both workflows. Workflow 1 would have to check whether workflow 2 is running and vice versa. You would then also have to implement recurring precondition checks, which I personally do not recommend (I can elaborate further on this if you want). There are also other options that involve AE scripts or similar. In *my opinion*, however, these are not best practices.

PROSENJIT MAJI's profile image
PROSENJIT MAJI

Hello Matthew, Good day!! Just wanted to add some examples if it helps - 

Using a SYNC object between JOB A & JOB B, will ensure Either A or B can run at a time. 
Whereas External Dependency is used to make sure JOB B should have a validation whether JOB A ran earlier as part of different flow/time. 

If I understood the requirement, it is like following - 
- JOB A ( which is used as ED for JOB B from another work flow ) runs multiple times in a day. 
   ( lets say the JOB A, the ED had 2 successful run with RUNID 1234, 4567 & ED has another ACTIVE instance RUNID 7890. )
- When JOB B gets initiated & based on the ED Parameters, you want to check if at least one execution is found of the ED. IF a latest ED RUN is in progress you want JOB B to WAIT till ED is COMPLETED. 
   ( lets say JOB B should WAIT till ED instance with RUNID 7890 is COMPLETED ) 

At this moment -
- If you have chosen - the setting - "Check if the external task end is - after the last workflow execution end"
  >> The JOB B will pick up RUNID 1234 & gets satisfied. It will NOT bother to check RUNID 4567 OR RUNID 7890.

- Also as you said - if you have chose - setting - "Check if the external task end is - after this workflow start" 
   and lets say ED RUNID 7890 is going to happen hours later, then the ED is going to WAIT till then. That you want to avoid ( as you said already ).

- If you want to force the ED at waiting state because you want JOB B should pick the RUNID 7890 once that is completed, 
  >> you need to choose - "Check if the external task end is - within XX : YY : ZZ (hhh:mm:ss) before this workflow start"
  >> Now the tricky part will be selecting some window that will NOT allow the ED to pick RUNID 1234 or RUNID 4567 at all. 

Lets add some timing for the calculation -
- the JOB A ( that is the ED for the JOB B )
  >> RUNID 1234 | starts at 02:00 | ends at 02:10
  >> RUNID 4567 | starts at 06:00 | ends at 06:15
  >> RUNID 7890 | starts at 10:00 | ends at 10:15 
Now the JOB B starts at 10:10 -- 
  >> Then you should keep the settings in the ED properties as following -
       EXPECTED STATUS = ENDED_OK
       "Check if the external task end is - within 01 : 00 : 00 (hhh:mm:ss) before this workflow start"

The above parameters will force the JOB B to pick the ED instance with RUNID 7890
and the EXPECTED STATUS will for a wait till the ED instance with RUNID 7890 gets COMPLETED. 

I hope, I understood your requirement as above is correct & the details I explained above helps!! Thanks.