Task Chaining

Last modified 20 Jun 2024 13:24 +02:00
EXPERIMENTAL
This feature is experimental. It means that it is not intended for production use. The feature is not finished. It is not stable. The implementation may contain bugs, the configuration may change at any moment without any warning and it may not work at all. Use at your own risk. This feature is not covered by midPoint support. In case that you are interested in supporting development of this feature, please consider purchasing midPoint Platform subscription.

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

This is not officially supported yet.

Using simple task dependencies

It works like 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

Git

<!--
  ~ Copyright (c) 2010-2024 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
      xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      oid="63fa34c4-0498-42a9-99ee-88506c79e975"
      version="1">
    <name>Recompute users</name>
    <activity>
        <work>
            <recomputation>
                <objects>
                    <type>UserType</type>
                </objects>
            </recomputation>
        </work>
    </activity>
    <taskIdentifier>1494860532840-0-1</taskIdentifier>
    <ownerRef xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
              oid="00000000-0000-0000-0000-000000000002"
              relation="org:default"
              type="c:UserType"><!-- administrator --></ownerRef>
    <dependent>1494860531232132-0-1</dependent>
    <schedule>
        <recurrence>single</recurrence>
    </schedule>
    <executionState>suspended</executionState>
</task>

.Second task

Git

<!--
  ~ Copyright (c) 2010-2024 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      oid="465fae8e-8229-4ad8-8c95-9d49fa589b35"
      version="1">
    <name>Recompute roles (after users)</name>
    <activity>
        <work>
            <recomputation>
                <objects>
                    <type>RoleType</type>
                </objects>
            </recomputation>
        </work>
    </activity>
    <taskIdentifier>1494860531232132-0-1</taskIdentifier>
    <ownerRef xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
              oid="00000000-0000-0000-0000-000000000002"
              relation="org:default"
              type="c:UserType"><!-- administrator --></ownerRef>
    <waitingReason>otherTasks</waitingReason>
    <schedule>
        <recurrence>single</recurrence>
    </schedule>
    <executionState>waiting</executionState>
</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 waiting / otherTasks one.

Was this page helpful?
YES NO
Thanks for your feedback