Scheduling workflows using the Data Studio REST API

Akshay Davis
Akshay Davis Experian Super Contributor
edited December 2023 in General

Aperture Data Studio is intended to be invoked from third party schedulers , like Windows Task Scheduler, Cron or even triggered from workflows within other applications.

The method for doing this is to use the Aperture Data Studio REST API  to execute a workflow from within a script, and trigger that script from the scheduler application. The script needs to ensure that it handles errors and other possible conditions from the workflow, such as successful completion but taking significantly shorter or longer than expected.

Workflow execution flow

Regardless of language and scheduler used, the logical steps to follow are

Attempt to login
  Successful
    Check if the workflow exists and can be executed
      Successful
        Execute workflow and wait for it to complete
        Is the state COMPLETED?
          Check any other conditions like time to complete or step results
          All OK
            Report successful completion
          Not OK
            Report workflow execution failure
        Is the state is FAILED?
          Report a workflow execution failure
      Unsuccessful
        Report workflow readiness failure
  Unsucessful
    Report a login failure

Powershell Example

We can use the logic above to run multiple workflows in parallel and chain workflows together to execute after one another. For example, if I wanted to:

  1. Execute "Workflow 1" and wait until finished then
  2. Execute "Workflow 2", "Workflow 3" and "Workflow 4" at the same time and wait for those all to finish and then
  3. Execute "Workflow 5" and "Workflow 6" at the same time and wait for those to finish, and then
  4. Execute "Workflow 7"

The execution plan would look as shown below, with each set of parallel workflows a separate phase.

We have implemented an example of this in Powershell. The script is attached below and would be executed as shown below.

>Powershell {path}\apertureExecuteWorkflow.ps1 -username {username} -password {password} -phasesWorkflows @(‘Workflow 1’), @(‘Workflow 2’, ‘Workflow 3’, ‘Workflow 4’), @(‘Workflow 5’, ‘Workflow 6’), @(‘Workflow 7’)

Please note that {path} needs to be the full path to the script.

An example execution is shown below.

>Powershell c:\temp\apertureExecuteWorkflow.ps1 -username myTestUser -password myTestPassword123 -phasesWorkflows @('Workflow1'), @('Workflow2A','Workflow2B'), @('Workflow3')


Comments