Skip to end of metadata
Go to start of metadata

The approaches described here are somewhat experimental. They might or might not work in any particular case.

Imagine you want to ensure that Task1 will execute before Task2; and that Task2 will start immediately after Task1 finishes.

There are two options here. None of them is officially supported yet. But they usually work, with some limitations.

Option 1: Using simple task dependencies

It works as this:

  • the dependent Task2 will not start unless the first Task1 is either closed or deleted
  • the result (fatal or partial failure, success) is not taken into account

So, basically:

  1. closing or deleting the first Task1 -> the second Task2 will start [when deleting it might take some time until midPoint realizes the first one has disappeared]
  2. suspending the first Task1 -> the second Task2 will not start
    1. of course, after you close, delete the first Task1, the second Task2 will start

This could work:

Step 1: prepare the following two task objects:

First task
Second task

Note that the first task is suspended and the second one is in waiting state.

Step 2: Import the tasks.

Step 3: Resume the first task.

Now the first task should execute. After it's closed the second one should start and execute.

The disadvantage of this solution is that re-execution of the tasks requires the second task to be manually switched from closed state back to waitingotherTasks one.

Option 2: Using partitioned tasks

This option is available since midPoint 3.8. This version brought so called Partitioned tasks. Although this feature is primarily used for partitioning standard tasks (like Reconciliation or Validity scanning), nothing prevents us from using it for custom tasks as well.

The following composite task prepares a CSV file and imports it.

There are some limitations, though. For example, if any of the subtasks end in a failure, the processing continues - and the overall result is "OK" even if subtasks fail. So, to see the status in an accurate way, you have to display subtasks along with root tasks.

The advantage is that the re-execution of such composite task is quite simple. It can be done either manually, or you can even make the master task recurring.

  • No labels