a little taste of UPcmd
This is a demo case of UPcmd for the home page
Demo
source
Main task yaml file
Vars:
greet_to: Tom
weather: sunny
tasks:
- name: task
desc: main task of hello world demo of UPcmd
task:
- func: call
desc: greet to Tom
do:
- greet
- func: call
desc: greet to Grace
vars:
greet_to: Grace
do:
- greet
- func: cmd
desc: do you get the idea?
do:
- name: print
cmd: |
Have you got a little taste of using the UPcmd?
- func: call
desc: greet to a team
vars:
team:
- Jason
- Connie
weather: stormy
loop: team
do:
- sayhi
- name: greet
desc: greet to some one
task:
- func: shell
desc: say hello
do:
- echo "Hello, {{.greet_to}}"
- func: cmd
desc: talk about weather
do:
- name: print
cmd: 'It is {{.weather}}'
- func: cmd
desc: ice break
do:
- name: print
cmd: 'What a great day!'
if: '{{eq .weather "sunny"}}'
else:
- func: cmd
do:
- name: print
cmd: 'What a bad day!!'
- name: sayhi
desc: say hi to some one
task:
- func: cmd
desc: say hi to someone
do:
- name: print
cmd: 'Hi {{.loopitem}}, how are you?'
- func: call
desc: greet to the team member
dvars:
- name: greet_to
value: '{{.loopitem}}'
do:
- greet
Main log file
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0151
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/c0151
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: main task of hello world demo of UPcmd ]
-Step1: [: greet to Tom ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Tom",
"weather": "sunny",
"up_runtime_task_layer_number": 0
})
=Task2: [task ==> greet: greet to some one ]
--Step1: [: say hello ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Tom",
"weather": "sunny",
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "Hello, {{.greet_to}}"
-
Hello, Tom
-
.. ok
. ok
--Step2: [: talk about weather ]
self: final context exec vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Tom\"",
Code: 0,
Output: "Hello, Tom",
ErrMsg: ""
}),
"greet_to": "Tom",
"weather": "sunny",
"up_runtime_task_layer_number": 1
})
~~SubStep1: [print: ]
It is sunny
--Step3: [: ice break ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Tom",
"weather": "sunny",
"up_runtime_task_layer_number": 1,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Tom\"",
Code: 0,
Output: "Hello, Tom",
ErrMsg: ""
})
})
~~SubStep1: [print: ]
What a great day!
-Step2: [: greet to Grace ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Grace",
"weather": "sunny",
"up_runtime_task_layer_number": 1
})
=Task2: [task ==> greet: greet to some one ]
--Step1: [: say hello ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Grace",
"weather": "sunny",
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "Hello, {{.greet_to}}"
-
Hello, Grace
-
.. ok
. ok
--Step2: [: talk about weather ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Grace\"",
Code: 0,
Output: "Hello, Grace",
ErrMsg: ""
}),
"greet_to": "Grace",
"weather": "sunny"
})
~~SubStep1: [print: ]
It is sunny
--Step3: [: ice break ]
self: final context exec vars:
(*core.Cache)({
"weather": "sunny",
"up_runtime_task_layer_number": 1,
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Grace\"",
Code: 0,
Output: "Hello, Grace",
ErrMsg: ""
}),
"greet_to": "Grace"
})
~~SubStep1: [print: ]
What a great day!
-Step3: [: do you get the idea? ]
self: final context exec vars:
(*core.Cache)({
"weather": "sunny",
"greet_to": "Tom",
"up_runtime_task_layer_number": 1
})
~SubStep1: [print: ]
Have you got a little taste of using the UPcmd?
-Step4: [: greet to a team ]
self: final context exec vars:
(*core.Cache)({
"weather": "stormy",
"up_runtime_task_layer_number": 1,
"team": {
"Jason",
"Connie"
},
"greet_to": "Tom"
})
=Task3: [task ==> sayhi: say hi to some one ]
--Step1: [: say hi to someone ]
self: final context exec vars:
(*core.Cache)({
"greet_to": "Tom",
"weather": "stormy",
"up_runtime_task_layer_number": 1,
"team": {
"Jason",
"Connie"
},
"loopitem": "Jason",
"loopindex": 0,
"loopindex1": 1
})
~~SubStep1: [print: ]
Hi Jason, how are you?
--Step2: [: greet to the team member ]
self: final context exec vars:
(*core.Cache)({
"weather": "stormy",
"up_runtime_task_layer_number": 1,
"team": {
"Jason",
"Connie"
},
"loopitem": "Jason",
"loopindex": 0,
"loopindex1": 1,
"greet_to": "Jason"
})
==Task2: [task/sayhi ==> greet: greet to some one ]
---Step1: [: say hello ]
self: final context exec vars:
(*core.Cache)({
"loopitem": "Jason",
"loopindex": 0,
"loopindex1": 1,
"greet_to": "Jason",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
}
})
cmd( 1):
echo "Hello, {{.greet_to}}"
-
Hello, Jason
-
.. ok
. ok
---Step2: [: talk about weather ]
self: final context exec vars:
(*core.Cache)({
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
},
"loopitem": "Jason",
"loopindex": 0,
"loopindex1": 1,
"greet_to": "Jason",
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Jason\"",
Code: 0,
Output: "Hello, Jason",
ErrMsg: ""
})
})
~~~SubStep1: [print: ]
It is stormy
---Step3: [: ice break ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
},
"loopitem": "Jason",
"loopindex": 0,
"loopindex1": 1,
"greet_to": "Jason",
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Jason\"",
Code: 0,
Output: "Hello, Jason",
ErrMsg: ""
}),
"weather": "stormy"
})
---Step1:
self: final context exec vars:
(*core.Cache)({
"loopindex": 0,
"loopindex1": 1,
"greet_to": "Jason",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
},
"loopitem": "Jason"
})
~~~SubStep1: [print: ]
What a bad day!!
=Task3: [task ==> sayhi: say hi to some one ]
--Step1: [: say hi to someone ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"team": {
"Jason",
"Connie"
},
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2,
"greet_to": "Tom",
"weather": "stormy"
})
~~SubStep1: [print: ]
Hi Connie, how are you?
--Step2: [: greet to the team member ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 1,
"team": {
"Jason",
"Connie"
},
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2,
"greet_to": "Connie",
"weather": "stormy"
})
==Task2: [task/sayhi ==> greet: greet to some one ]
---Step1: [: say hello ]
self: final context exec vars:
(*core.Cache)({
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2,
"greet_to": "Connie",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
}
})
cmd( 1):
echo "Hello, {{.greet_to}}"
-
Hello, Connie
-
.. ok
. ok
---Step2: [: talk about weather ]
self: final context exec vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Connie\"",
Code: 0,
Output: "Hello, Connie",
ErrMsg: ""
}),
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2,
"greet_to": "Connie",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
}
})
~~~SubStep1: [print: ]
It is stormy
---Step3: [: ice break ]
self: final context exec vars:
(*core.Cache)({
"last_result": (*utils.ExecResult)({
Cmd: "echo \"Hello, Connie\"",
Code: 0,
Output: "Hello, Connie",
ErrMsg: ""
}),
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2,
"greet_to": "Connie",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
}
})
---Step1:
self: final context exec vars:
(*core.Cache)({
"greet_to": "Connie",
"weather": "stormy",
"up_runtime_task_layer_number": 2,
"team": {
"Jason",
"Connie"
},
"loopitem": "Connie",
"loopindex": 1,
"loopindex1": 2
})
~~~SubStep1: [print: ]
What a bad day!!
Logs with different verbose level
Raw logs with different verbose level