aboutsummaryrefslogtreecommitdiffstats
path: root/laas/actions/workflows/snapshot_master_workflow.yaml
blob: 49640033754748e6c5ec07720c87b7320f0a70b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
##############################################################################
# Copyright 2018 Parker Berberian and Others                                 #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the License);              #
# you may not use this file except in compliance with the License.           #
# You may obtain a copy of the License at                                    #
#                                                                            #
#    http://www.apache.org/licenses/LICENSE-2.0                              #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an AS IS BASIS,            #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
##############################################################################

version: '2.0'
laas.snapshot_master_workflow:
    description: fulfills all snapshot tasks from the dashboard
    input:
        - job_id

    tasks:

        get_tasks:
            action: laas.get_task_list
            input:
                job_id: <% $.job_id %>
                type: "snapshot"
            publish:
                tasklist: <% task(get_tasks).result.result %>
            on-success:
                - get_start_index

        get_start_index:
            action: core.local cmd="echo 0"
            publish:
                index: <% int(task(get_start_index).result.stdout) %>
            on-success:
                - finish: <% $.index >= len($.tasklist) %>
                - snapshot_task: <% $.index < len($.tasklist) %>

        loop:
            action: core.local
            input:
                cmd: 'echo $((<% $.index %>+1))'
            publish:
                index: <% task(loop).result.stdout %>
            on-success:
                - finish: <% $.index >= len($.tasklist) %>
                - snapshot_task: <% $.index < len($.tasklist) %>

        snapshot_task:
            action: laas.snapshot_workflow
            input:
                task_id: <% $.tasklist[$.index] %>
                job_id: <% $.job_id %>
            on-success:
                - loop

        finish:
            action: core.local cmd="exit 0"
            on-success: succeed