tasks:
- name: task
task:
- func: cmd
desc: step 1
do:
- name: print
cmd: step 1
- name: panic
- name: print
cmd: extra step ......... it will never reach here
rescue: false
finally: close_file
- func: cmd
desc: step 2
do:
- name: print
cmd: step 2
- name: close_file
task:
- func: shell
name: close_file
desc: |
ensure the opened file is closed
do:
- echo "close the file ....."
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> f0172
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/f0172
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1: [: step 1 ]
self: final context exec vars:
(*core.Cache)({
"up_runtime_task_layer_number": 0
})
~SubStep1: [print: ]
step 1
~SubStep2: [panic: ]
WARN: [manual panic] - [manual trigger a panic cmd]
Step Finally:
Recovered from: manual trigger a panic cmd
=Task2: [task ==> close_file: ]
--Step1: [
close_fileensure the opened file is closed
]
self: final context exec vars:
(*core.Cache)({
"up_runtime_shell_exec_result": (*utils.ExecResult)(<nil>),
"up_runtime_task_layer_number": 1
})
cmd( 1):
echo "close the file ....."
-
close the file .....
-
.. ok
. ok
WARN: [Not rescued in step level] - [please assess the panic problem and cause, fix it before re-run the task]
WARN: [Not rescued in task level] - [please assess the panic problem and cause, fix it before re-run the task]
task finally -> manual trigger a panic cmd
This demos that the execution will abort if you do not explicitly resuce the panic