only check for deployment succeeded event

This commit is contained in:
Peter Jausovec 2016-12-15 14:42:01 -08:00
Родитель 518c7a4e89
Коммит e07c6af3f7
2 изменённых файлов: 1 добавлений и 16 удалений

Просмотреть файл

@ -242,8 +242,7 @@ class Marathon(object):
if not processor_catchup:
logging.info('Giving deployment monitor more time to catch-up on events')
for _ in range(0, 5):
if not processor.deployment_succeeded()\
and not processor.deployment_failed():
if not processor.deployment_succeeded():
time.sleep(1)
# TODO:Check that the group was deployed correctly (instance count, healthcheck)
processor_catchup = True

Просмотреть файл

@ -150,13 +150,10 @@ class DeploymentMonitor(object):
"""
def __init__(self, marathon, app_ids, deployment_id):
self._marathon = marathon
self._deployment_failed = False
self._deployment_succeeded = False
self._app_ids = app_ids
self._deployment_id = deployment_id
self.stopped = False
self._failed_event = None
self._failure_message = None
self._thread = threading.Thread(
target=DeploymentMonitor._process_events, args=(self,))
@ -167,12 +164,6 @@ class DeploymentMonitor(object):
self._thread.daemon = True
self._thread.start()
def deployment_failed(self):
"""
True if deployment failed, false otherwise
"""
return self._deployment_failed
def deployment_succeeded(self):
"""
True if deployment succeeded, false otherwise
@ -199,15 +190,10 @@ class DeploymentMonitor(object):
if event.app_id() in self._app_ids:
logging.info(event.status())
if event.is_task_failed() or event.is_task_killed():
self._deployment_failed = True
self._failed_event = event
self._log_stderr(event)
elif event.is_deployment_succeeded():
if self._deployment_id == event.data['id']:
self._deployment_succeeded = True
elif event.is_deployment_failed():
if self._deployment_id == event.data['id']:
self._deployment_failed = True
def _log_stderr(self, event):
"""