Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions marathon/models/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ class MarathonInfo(MarathonResource):
:param str version:
:param zookeeper_config:
:type zookeeper_config: :class:`marathon.models.info.MarathonZooKeeperConfig` or dict
:param http_config:
:type http_config: :class:`marathon.models.info.MarathonHttpConfig` or dict
:param event_subscriber:
:type event_subscriber: :class`marathon.models.info.MarathonEventSubscriber` or dict
"""

def __init__(self, framework_id=None, leader=None, marathon_config=None, name=None, version=None,
zookeeper_config=None):
zookeeper_config=None, http_config=None, event_subscriber=None):
self.framework_id = framework_id
self.leader = leader
self.marathon_config = marathon_config if isinstance(marathon_config, MarathonConfig) \
Expand All @@ -26,12 +30,16 @@ def __init__(self, framework_id=None, leader=None, marathon_config=None, name=No
self.version = version
self.zookeeper_config = zookeeper_config if isinstance(zookeeper_config, MarathonZooKeeperConfig) \
else MarathonZooKeeperConfig().from_json(zookeeper_config)
self.http_config = http_config if isinstance(http_config, MarathonHttpConfig) \
else MarathonHttpConfig().from_json(http_config)
self.event_subscriber = event_subscriber if isinstance(event_subscriber, MarathonEventSubscriber) \
else MarathonEventSubscriber().from_json(event_subscriber)


class MarathonConfig(MarathonObject):
"""Marathon Application resource.
"""Marathon config resource.

See: https://mesosphere.github.io/marathon/docs/rest-api.html#deployments
See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info

:param bool checkpoint:
:param str executor:
Expand Down Expand Up @@ -67,9 +75,9 @@ def __init__(self, checkpoint=None, executor=None, failover_timeout=None, ha=Non


class MarathonZooKeeperConfig(MarathonObject):
"""Marathon Application resource.
"""Marathon zookeeper config resource.

See: https://mesosphere.github.io/marathon/docs/rest-api.html#deployments
See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info

:param str zk:
:param dict zk_future_timeout:
Expand All @@ -85,4 +93,32 @@ def __init__(self, zk=None, zk_future_timeout=None, zk_hosts=None, zk_path=None,
self.zk_hosts = zk_hosts
self.zk_path = zk_path
self.zk_state = zk_state
self.zk_timeout = zk_timeout
self.zk_timeout = zk_timeout

class MarathonHttpConfig(MarathonObject):
"""Marathon http config resource.

See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info

:param str assets_path:
:param int http_port:
:param int https_port:
"""

def __init__(self, assets_path=None, http_port=None, https_port=None):
self.assets_path = assets_path
self.http_port = http_port
self.https_port = https_port

class MarathonEventSubscriber(MarathonObject):
"""Marathon event subscriber resource.

See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info

:param str type:
:param list[str] http_endpoints:
"""

def __init__(self, type=None, http_endpoints=None):
self.type = type
self.http_endpoints = http_endpoints
4 changes: 3 additions & 1 deletion marathon/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ class MarathonTask(MarathonResource):
:param started_at: when this task was started
:type started_at: datetime or str
:param str version: app version with which this task was started
:param list[int] service_ports: ports exposed for load balancing
"""

DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'

def __init__(self, app_id=None, health_check_results=None, host=None, id=None, ports=None, staged_at=None, started_at=None, version=None):
def __init__(self, app_id=None, health_check_results=None, host=None, id=None, ports=None, staged_at=None, started_at=None, version=None, service_ports=None):
self.app_id = app_id
self.health_check_results = health_check_results or []
self.health_check_results = [
Expand All @@ -36,6 +37,7 @@ def __init__(self, app_id=None, health_check_results=None, host=None, id=None, p
self.started_at = started_at if (started_at is None or isinstance(started_at, datetime)) \
else datetime.strptime(started_at, self.DATETIME_FORMAT)
self.version = version
self.service_ports = service_ports or []


class MarathonHealthCheckResult(MarathonObject):
Expand Down