This demo shows that you can adjust the seqence of the callee tasks
The result of concret implementation of callee_task1/2 will be different depending on the input vars from the caller
Please take a look of the log to see what are the contextual vars in runtime are
vars:
a: runtime-a
e: runtime-e
k: runtime-k
tasks:
- name: callee_task1
task:
- func: shell
vars:
a: callee-a
b: callee-b
c: callee-c
do:
- echo "exec ref-task1"
- |
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
- name: task
desc:
task:
- func: call
desc: call1
vars:
a: caller-ref-1a
b: caller-ref-1b
do:
- callee_task1
- callee_task2
- func: call
desc: call2
vars:
a: caller-ref-2a
b: caller-ref-2b
do:
- callee_task2
- callee_task1
- name: callee_task2
task:
- func: shell
vars:
a: callee-a
b: callee-b
c: callee-c
do:
- echo "exec ref-task2"
- |
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0017
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/c0017
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task2: [task ==> task: ]
-Step1: [: call1 ]
self: final context exec vars:
(*core.Cache)({
"e": "runtime-e",
"up_runtime_task_layer_number": 0,
"b": "caller-ref-1b",
"k": "runtime-k",
"a": "caller-ref-1a"
})
=Task1: [task ==> callee_task1: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"e": "runtime-e",
"up_runtime_task_layer_number": 1,
"a": "caller-ref-1a",
"b": "caller-ref-1b",
"c": "callee-c",
"k": "runtime-k"
})
cmd( 1):
echo "exec ref-task1"
-
exec ref-task1
-
.. ok
cmd( 2):
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
-
vars:
a: caller-ref-1a
b: caller-ref-1b
c: callee-c
e: runtime-e
k: runtime-k
-
.. ok
. ok
=Task3: [task ==> callee_task2: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"c": "callee-c",
"k": "runtime-k",
"e": "runtime-e",
"up_runtime_task_layer_number": 1,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"\"\"\nvars:\na: caller-ref-1a\nb: caller-ref-1b\nc: callee-c\ne: runtime-e\nk: runtime-k\n\"\"\"\n",
Code: 0,
Output: "vars:\na: caller-ref-1a\nb: caller-ref-1b\nc: callee-c\ne: runtime-e\nk: runtime-k",
ErrMsg: ""
}),
"a": "caller-ref-1a",
"b": "caller-ref-1b"
})
cmd( 1):
echo "exec ref-task2"
-
exec ref-task2
-
.. ok
cmd( 2):
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
-
vars:
a: caller-ref-1a
b: caller-ref-1b
c: callee-c
e: runtime-e
k: runtime-k
-
.. ok
. ok
-Step2: [: call2 ]
self: final context exec vars:
(*core.Cache)({
"a": "caller-ref-2a",
"e": "runtime-e",
"up_runtime_task_layer_number": 1,
"b": "caller-ref-2b",
"k": "runtime-k"
})
=Task3: [task ==> callee_task2: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"k": "runtime-k",
"a": "caller-ref-2a",
"b": "caller-ref-2b",
"c": "callee-c",
"e": "runtime-e",
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "exec ref-task2"
-
exec ref-task2
-
.. ok
cmd( 2):
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
-
vars:
a: caller-ref-2a
b: caller-ref-2b
c: callee-c
e: runtime-e
k: runtime-k
-
.. ok
. ok
=Task1: [task ==> callee_task1: ]
--Step1:
self: final context exec vars:
(*core.Cache)({
"b": "caller-ref-2b",
"c": "callee-c",
"up_runtime_task_layer_number": 1,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"\"\"\nvars:\na: caller-ref-2a\nb: caller-ref-2b\nc: callee-c\ne: runtime-e\nk: runtime-k\n\"\"\"\n",
Code: 0,
Output: "vars:\na: caller-ref-2a\nb: caller-ref-2b\nc: callee-c\ne: runtime-e\nk: runtime-k",
ErrMsg: ""
}),
"k": "runtime-k",
"e": "runtime-e",
"a": "caller-ref-2a"
})
cmd( 1):
echo "exec ref-task1"
-
exec ref-task1
-
.. ok
cmd( 2):
echo """
vars:
a: {{.a}}
b: {{.b}}
c: {{.c}}
e: {{.e}}
k: {{.k}}
"""
-
vars:
a: caller-ref-2a
b: caller-ref-2b
c: callee-c
e: runtime-e
k: runtime-k
-
.. ok
. ok