github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0169.yml (about) 1 doc_meta: | 2 folder: loop 3 title: loop and retry example 4 head: | 5 This showcases a working example how to use combination of: ignoreError, timeout, loopRange, block, sleep to make a retry solution 6 7 sections: 8 - title: Demo 9 log: yes 10 11 tasks: 12 - 13 name: task 14 task: 15 - 16 func: shell 17 do: 18 - ping goole.com 19 timeout: 500 20 flags: 21 - ignoreError 22 23 - 24 func: shell 25 do: 26 - echo "hello, world" 27 - ping goole.com 28 - echo "hello, world" 29 timeout: 500 30 flags: 31 - ignoreError 32 33 - 34 func: shell 35 desc: | 36 an example of retry 37 it tries to ping 4 times with a timeout of 2 seconds every time 38 loop: 39 - retry1 40 - retry2 41 - retry3 42 - retry4 43 do: 44 - ping goole.com 45 timeout: 500 46 flags: 47 - ignoreError 48 49 - 50 func: block 51 desc: | 52 an example of retry 53 it tries to ping 4 times with a timeout of 2 seconds every time 54 with every attemp it puts a delay of 2 seconds 55 loop: 56 - retry1 57 - retry2 58 - retry3 59 - retry4 60 do: 61 - 62 func: shell 63 do: 64 - ping goole.com 65 timeout: 500 66 flags: 67 - ignoreError 68 69 - 70 func: cmd 71 do: 72 - name: sleep 73 desc: delay 2 seconds in each attemp 74 cmd: 200 75 76 - 77 func: shell 78 desc: | 79 loop with customised range 80 loop: '{{loopRange 100 105 "myretry"}}' 81 do: 82 - ping goole.com 83 timeout: 500 84 flags: 85 - ignoreError 86 87 - 88 func: block 89 desc: | 90 an example of retry 91 it tries to ping 4 times with a timeout of 2 seconds every time 92 with every attemp it puts a delay of 2 seconds 93 it also uses dynamic loopRange instead of prepared list of value 94 loop: '{{loopRange 100 103 "myretry"}}' 95 do: 96 - 97 func: shell 98 do: 99 - ping goole.com 100 timeout: 500 101 flags: 102 - ignoreError 103 - 104 func: cmd 105 do: 106 - name: sleep 107 desc: delay 2 seconds in each attemp 108 cmd: 200