File: queue.py

package info (click to toggle)
python-marathon 0.13.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: python: 1,969; makefile: 185; sh: 58
file content (51 lines) | stat: -rw-r--r-- 1,946 bytes parent folder | download | duplicates (3)
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
from .base import MarathonResource
from .app import MarathonApp


class MarathonQueueItem(MarathonResource):

    """Marathon queue item.

    See: https://mesosphere.github.io/marathon/docs/rest-api.html#queue

    List all the tasks queued up or waiting to be scheduled. This is mainly
    used for troubleshooting and occurs when scaling changes are requested and the
    volume of scaling changes out paces the ability to schedule those tasks. In
    addition to the application in the queue, you see also the task count that
    needs to be started.

    If the task has a rate limit, then a delay to the start gets applied. You
    can see this delay for every application with the seconds to wait before
    the next launch will be tried.

    :param app:
    :type app: :class:`marathon.models.app.MarathonApp` or dict
    :param delay: queue item delay
    :type delay: :class:`marathon.models.app.MarathonQueueItemDelay` or dict
    :param bool overdue:
    """

    def __init__(self, app=None, overdue=None, count=None, delay=None, since=None,
                 processed_offers_summary=None, last_unused_offers=None):
        self.app = app if isinstance(
            app, MarathonApp) else MarathonApp().from_json(app)
        self.overdue = overdue
        self.count = count
        self.delay = delay if isinstance(
            delay, MarathonQueueItemDelay) else MarathonQueueItemDelay().from_json(delay)
        self.since = since
        self.processed_offers_summary = processed_offers_summary
        self.last_unused_offers = last_unused_offers


class MarathonQueueItemDelay(MarathonResource):

    """Marathon queue item delay.

    :param int time_left_seconds: Seconds to wait before the next launch will be tried.
    :param bool overdue: Is the queue item overdue.
    """

    def __init__(self, time_left_seconds=None, overdue=None):
        self.time_left_seconds = time_left_seconds
        self.overdue = overdue