Complex call layers

Showcase a combination of an external module call and internal func call would work properly and the vars returned from multple layers will return to caller

source

config file - upconfig.yml

    
    version: 1.0.0
    Verbose: v
    MaxCallLayers: 8
    RefDir: .
    TaskFile: up.yml
    ConfigDir: .
    ConfigFile: upconfig.yml
    
    Modules:
    
       #if there is no repo, then it will use the dir as module and incorporate as module
      - dir: hello-module/
        alias: hello-module
    

up task - up.yml

    notes:
      - regression test the multiple layer's call would work and vars will be handled properly
    
    vars:
      a: caller-global-aaa
      b: caller-global-bbb
      e: caller-global-eee
    tasks:
      -
        name: Main
        desc: main entry
        task:
    
          -
            func: cmd
            do:
              -
                name: inspect
                desc: the vars in caller before invoking module task
                cmd:
                  - exec_vars
                  - exec_base_vars
    
          -
            func: call
            do: hello-module.Say_world
    
          -
            func: cmd
            do:
              -
                name: inspect
                desc: the vars in caller after invoking module task
                cmd:
                  - exec_vars
                  - exec_base_vars
    
              -
                name: assert
                desc: |
                  note the k is the result from the 2nd layer call
                cmd:
                  - '{{eq .a "caller-global-aaa"}}'
                  - '{{eq .b "caller-global-bbb"}}'
                  - '{{eq .c "module-global-ccc"}}'
                  - '{{eq .e "caller-global-eee"}}'
                  - '{{eq .k "module-second_layer_local-kkk"}}'
    

up module task - up.yml

    
    vars:
      a: module-global-aaa
      c: module-global-ccc
    
    tasks:
      -
        name: Main
        desc: main entry
        task:
          -
            func: shell
            desc: main job
            do:
              - echo "hello "
    
          -
            func: call
            do: Say_world
    
      -
        name: Say_world
        task:
          -
            func: cmd
            vars:
              a: module-local-aaa
              b: module-local-bbb
              d: module-local-ddd
            do:
              -
                name: inspect
                desc: |
                  the result would be:
                  a: caller-global-aaa
                  b: caller-global-bbb
                  c: module-global-ccc
                  d: module-local-ddd
                  e: caller-global-eee
                cmd:
                  - exec_vars
                  - exec_base_vars
    
              -
                name: assert
                cmd:
                  - '{{eq .a "caller-global-aaa"}}'
                  - '{{eq .b "caller-global-bbb"}}'
                  - '{{eq .c "module-global-ccc"}}'
                  - '{{eq .d "module-local-ddd"}}'
                  - '{{eq .e "caller-global-eee"}}'
    
              - name: return
                cmd:
                  - c
    
          -
            func: call
            vars:
              a: module-local-call-aaa
              b: module-local-call-bbb
              d: module-local-call-ddd
              h: module-local-call-hhh
              i: module-local-call-iii
            do: second_layer_internal_call
    
          -
            func: cmd
            do:
              - name: return
                desc: var k is return from second_layer_internal_call
                cmd:
                  - k
    
      -
        name: second_layer_internal_call
        task:
          -
            func: cmd
            vars:
              a: module-second_layer_local-aaa
              b: module-second_layer_local-bbb
              d: module-second_layer_local-ddd
              i: module-second_layer_local-iii
              k: module-second_layer_local-kkk
    
            do:
              -
                name: inspect
                desc: |
                  second_layer_internal_call
                  a: module-local-call-aaa
                  b: module-local-call-bbb
                  d: module-local-call-ddd
                cmd:
                  - exec_vars
                  - exec_base_vars
    
              -
                name: assert
                cmd:
                  - '{{eq .a "caller-global-aaa"}}'
                  - '{{eq .b "caller-global-bbb"}}'
                  - '{{eq .c "module-global-ccc"}}'
                  - '{{eq .d "module-local-call-ddd"}}'
                  - '{{eq .e "caller-global-eee"}}'
                  - '{{eq .i "module-local-call-iii"}}'
                  - '{{eq .h "module-local-call-hhh"}}'
                  - '{{eq .k "module-second_layer_local-kkk"}}'
    
              - name: return
                cmd:
                  - k
    
Main log file
    loading [Config]:  ./tests/modtests/0006/upconfig.yml
    Main config:
                 Version -> 1.0.0
                  RefDir -> ./tests/modtests/0006
                 WorkDir -> refdir
              AbsWorkDir -> /up_project/up/tests/modtests/0006
                TaskFile -> up.yml
                 Verbose -> v
              ModuleName -> self
               ShellType -> /bin/sh
           MaxCallLayers -> 8
                 Timeout -> 3600000
     MaxModuelCallLayers -> 256
               EntryTask -> Main
      ModRepoUsernameRef -> 
      ModRepoPasswordRef -> 
    work dir: /up_project/up/tests/modtests/0006
    -exec task: Main
    loading [Task]:  ./up.yml
    module: [self], instance id: [dev], exec profile: []
    Task1: [Main ==> Main: main entry ]
    -Step1:
    ~SubStep1: [inspect: the vars in caller before invoking module task ]
     1: inspect[exec_vars]
    (*core.Cache)({
      "b": "caller-global-bbb",
      "e": "caller-global-eee",
      "a": "caller-global-aaa",
      "up_runtime_task_layer_number": 0
    })
    
     2: inspect[exec_base_vars]
    {
      "b": "caller-global-bbb",
      "e": "caller-global-eee",
      "a": "caller-global-aaa"
    }
    
    -Step2:
     WARN: [config file does not exist] - [use builtin defaults]
    loading [Task]:  ./up.yml
    module: [hello-module], instance id: [nonamed], exec profile: []
     WARN: [*be aware*] - [both instance id and exec profile are not set]
    =>call module: [hello-module] task: [Say_world]
    Task2: [TODO: Main Caller Taskname ==> Say_world:  ]
    -Step1:
    ~SubStep1: [inspect: the result would be:
    a: caller-global-aaa
    b: caller-global-bbb
    c: module-global-ccc
    d: module-local-ddd
    e: caller-global-eee
     ]
     1: inspect[exec_vars]
    (*core.Cache)({
      "c": "module-global-ccc",
      "up_runtime_tasker_layer_number": 2,
      "a": "caller-global-aaa",
      "b": "caller-global-bbb",
      "d": "module-local-ddd",
      "e": "caller-global-eee",
      "up_runtime_task_layer_number": 0
    })
    
     2: inspect[exec_base_vars]
    {
      "up_runtime_task_layer_number": 0,
      "b": "caller-global-bbb",
      "a": "caller-global-aaa",
      "c": "module-global-ccc",
      "e": "caller-global-eee"
    }
    
    ~SubStep2: [assert:  ]
     1 ASSERT OK:     [{{eq .a "caller-global-aaa"}}]
     2 ASSERT OK:     [{{eq .b "caller-global-bbb"}}]
     3 ASSERT OK:     [{{eq .c "module-global-ccc"}}]
     4 ASSERT OK:     [{{eq .d "module-local-ddd"}}]
     5 ASSERT OK:     [{{eq .e "caller-global-eee"}}]
    ~SubStep3: [return:  ]
    -Step2:
    =Task3: [TODO: Main Caller Taskname/Say_world ==> second_layer_internal_call:  ]
    --Step1:
    ~~SubStep1: [inspect: second_layer_internal_call
    a: module-local-call-aaa
    b: module-local-call-bbb
    d: module-local-call-ddd
     ]
     1: inspect[exec_vars]
    (*core.Cache)({
      "b": "caller-global-bbb",
      "i": "module-local-call-iii",
      "h": "module-local-call-hhh",
      "c": "module-global-ccc",
      "a": "caller-global-aaa",
      "d": "module-local-call-ddd",
      "k": "module-second_layer_local-kkk",
      "e": "caller-global-eee",
      "up_runtime_tasker_layer_number": 2,
      "up_runtime_task_layer_number": 1
    })
    
     2: inspect[exec_base_vars]
    {
      "d": "module-local-call-ddd",
      "h": "module-local-call-hhh",
      "c": "module-global-ccc",
      "up_runtime_task_layer_number": 0,
      "i": "module-local-call-iii",
      "a": "caller-global-aaa",
      "b": "caller-global-bbb",
      "e": "caller-global-eee",
      "up_runtime_tasker_layer_number": 2
    }
    
    ~~SubStep2: [assert:  ]
     1 ASSERT OK:     [{{eq .a "caller-global-aaa"}}]
     2 ASSERT OK:     [{{eq .b "caller-global-bbb"}}]
     3 ASSERT OK:     [{{eq .c "module-global-ccc"}}]
     4 ASSERT OK:     [{{eq .d "module-local-call-ddd"}}]
     5 ASSERT OK:     [{{eq .e "caller-global-eee"}}]
     6 ASSERT OK:     [{{eq .i "module-local-call-iii"}}]
     7 ASSERT OK:     [{{eq .h "module-local-call-hhh"}}]
     8 ASSERT OK:     [{{eq .k "module-second_layer_local-kkk"}}]
    ~~SubStep3: [return:  ]
    -Step3:
    ~SubStep1: [return: var k is return from second_layer_internal_call ]
    -Step3:
    ~SubStep1: [inspect: the vars in caller after invoking module task ]
     1: inspect[exec_vars]
    (*core.Cache)({
      "up_runtime_tasker_layer_number": 2,
      "c": "module-global-ccc",
      "k": "module-second_layer_local-kkk",
      "b": "caller-global-bbb",
      "e": "caller-global-eee",
      "a": "caller-global-aaa",
      "up_runtime_task_layer_number": 1
    })
    
     2: inspect[exec_base_vars]
    {
      "b": "caller-global-bbb",
      "e": "caller-global-eee",
      "a": "caller-global-aaa",
      "c": "module-global-ccc",
      "k": "module-second_layer_local-kkk"
    }
    
    ~SubStep2: [assert: note the k is the result from the 2nd layer call
     ]
     1 ASSERT OK:     [{{eq .a "caller-global-aaa"}}]
     2 ASSERT OK:     [{{eq .b "caller-global-bbb"}}]
     3 ASSERT OK:     [{{eq .c "module-global-ccc"}}]
     4 ASSERT OK:     [{{eq .e "caller-global-eee"}}]
     5 ASSERT OK:     [{{eq .k "module-second_layer_local-kkk"}}]
    
Logs with different verbose level
Raw logs with different verbose level