nutanix / calm-dsl

Keep Calm and DSL On!

Home Page:https://nutanix.github.io/calm-dsl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Compiling a flow from parallel tasks to a single child fails

pipoe2h opened this issue · comments

Describe the bug
There is a workflow with a task that depends on two previous tasks running in parallel to complete. This is possible to model in the UI and when using decompile this is the output

image

    @action
    def __install__():

        with parallel() as p0:
            with branch(p0):
                CalmTask.Delay(name="Task 1", delay_seconds=1, target=ref(Service1))

                CalmTask.Delay(name="Task 3", delay_seconds=1, target=ref(Service1))
            with branch(p0):
                CalmTask.Delay(name="Task 2", delay_seconds=1, target=ref(Service1))

                CalmTask.Delay(name="Task 3", delay_seconds=1, target=ref(Service1))

If you try to build a BP from scratch with DSL using this structure, or if you use the decompiled one and push it back AS-IS with create, it fails:

calm create bp -f delete/blueprint.py -n decompiled_dsl_create_parallel_to_single -fc
/usr/local/lib/python3.11/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.18) or chardet (5.2.0)/charset_normalizer (2.0.12) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
[2024-02-14 10:57:02] [ERROR] [calm.dsl.api.connection:324] Oops! Something went wrong.
{
    "error": {
        "api_version": "3.1",
        "code": 422,
        "kind": "blueprint",
        "message_list": [
            {
                "details": {},
                "message": "Duplicate task name Task 3",
                "reason": "INVALID_REQUEST"
            }
        ],
        "state": "ERROR"
    },
    "code": 422
}
[2024-02-14 10:57:02] [ERROR] [calm.dsl.cli.bp_commands:218] {'api_version': '3.1', 'code': 422, 'kind': 'blueprint', 'message_list': [{'details': {}, 'message': 'Duplicate task name Task 3', 'reason': 'INVALID_REQUEST'}], 'state': 'ERROR'}

Branch/Container
master

To Reproduce
Steps to reproduce the behavior:

  1. Upload attached BP
  2. Set credential password (dummy)
  3. DSL decompile
  4. DSL create the decompiled BP without modifying

Expected behavior
Be able to replicate the same workflows in the UI but with DSL

System Configuration:

  • OS: Linux
  • Python: 3.11

Additional context
Blueprint attached
dsl_create_parallel_to_single.json