File: marathon.py

package info (click to toggle)
python-dcos 0.2.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,440 kB
  • sloc: python: 8,196; sh: 194; makefile: 36
file content (161 lines) | stat: -rw-r--r-- 4,248 bytes parent folder | download | duplicates (4)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
def app_fixture():
    """ Marathon app fixture.

    :rtype: dict
    """

    return {
        "acceptedResourceRoles": None,
        "args": None,
        "backoffFactor": 1.15,
        "backoffSeconds": 1,
        "cmd": "sleep 1000",
        "constraints": [],
        "container": None,
        "cpus": 0.1,
        "dependencies": [],
        "deployments": [],
        "disk": 0.0,
        "env": {},
        "executor": "",
        "healthChecks": [],
        "id": "/test-app",
        "instances": 1,
        "labels": {
            "PACKAGE_ID": "test-app",
            "PACKAGE_VERSION": "1.2.3"
        },
        "maxLaunchDelaySeconds": 3600,
        "mem": 16.0,
        "ports": [
            10000
        ],
        "requirePorts": False,
        "storeUrls": [],
        "tasksHealthy": 0,
        "tasksRunning": 1,
        "tasksStaged": 0,
        "tasksUnhealthy": 0,
        "upgradeStrategy": {
            "maximumOverCapacity": 1.0,
            "minimumHealthCapacity": 1.0
        },
        "uris": [],
        "user": None,
        "version": "2015-05-28T21:21:05.064Z"
    }


def deployment_fixture():
    """ Marathon deployment fixture.

    :rtype: dict
    """

    return {
        "affectedApps": [
            "/cassandra/dcos"
        ],
        "currentActions": [
            {
                "action": "ScaleApplication",
                "app": "/cassandra/dcos"
            }
        ],
        "currentStep": 2,
        "id": "bebb8ffd-118e-4067-8fcb-d19e44126911",
        "steps": [
            [
                {
                    "action": "StartApplication",
                    "app": "/cassandra/dcos"
                }
            ],
            [
                {
                    "action": "ScaleApplication",
                    "app": "/cassandra/dcos"
                }
            ]
        ],
        "totalSteps": 2,
        "version": "2015-05-29T01:13:47.694Z"
    }


def app_task_fixture():
    """ Marathon task fixture.

    :rtype: dict
    """

    return {
        "appId": "/zero-instance-app",
        "host": "dcos-01",
        "id": "zero-instance-app.027b3a83-063d-11e5-84a3-56847afe9799",
        "ports": [
            8165
        ],
        "servicePorts": [
            10001
        ],
        "stagedAt": "2015-05-29T19:58:00.907Z",
        "startedAt": "2015-05-29T19:58:01.114Z",
        "version": "2015-05-29T18:50:58.941Z"
    }


def group_fixture():
    """ Marathon group fixture.

    :rtype: dict
    """

    return {
        "apps": [],
        "dependencies": [],
        "groups": [
            {
                "apps": [
                    {
                        "acceptedResourceRoles": None,
                        "args": None,
                        "backoffFactor": 1.15,
                        "backoffSeconds": 1,
                        "cmd": "sleep 1",
                        "constraints": [],
                        "container": None,
                        "cpus": 1.0,
                        "dependencies": [],
                        "disk": 0.0,
                        "env": {},
                        "executor": "",
                        "healthChecks": [],
                        "id": "/test-group/sleep/goodnight",
                        "instances": 0,
                        "labels": {},
                        "maxLaunchDelaySeconds": 3600,
                        "mem": 128.0,
                        "ports": [
                            10000
                        ],
                        "requirePorts": False,
                        "storeUrls": [],
                        "upgradeStrategy": {
                            "maximumOverCapacity": 1.0,
                            "minimumHealthCapacity": 1.0
                        },
                        "uris": [],
                        "user": None,
                        "version": "2015-05-29T23:12:46.187Z"
                    }
                ],
                "dependencies": [],
                "groups": [],
                "id": "/test-group/sleep",
                "version": "2015-05-29T23:12:46.187Z"
            }
        ],
        "id": "/test-group",
        "version": "2015-05-29T23:12:46.187Z"
    }