You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by ma...@apache.org on 2014/05/23 02:28:16 UTC
git commit: Mistyped or unknown to scheduler hosts should not result
in failing the SLA command.
Repository: incubator-aurora
Updated Branches:
refs/heads/master 43c8ccba3 -> ccd6a492c
Mistyped or unknown to scheduler hosts should not result in failing the SLA command.
Bugs closed: AURORA-442
Reviewed at https://reviews.apache.org/r/21597/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/ccd6a492
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/ccd6a492
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/ccd6a492
Branch: refs/heads/master
Commit: ccd6a492c403339ba214537f50a5ae0659cbf1c7
Parents: 43c8ccb
Author: Maxim Khutornenko <ma...@apache.org>
Authored: Thu May 22 17:27:51 2014 -0700
Committer: Maxim Khutornenko <ma...@apache.org>
Committed: Thu May 22 17:27:51 2014 -0700
----------------------------------------------------------------------
src/main/python/apache/aurora/client/api/sla.py | 6 ++++--
src/main/python/apache/aurora/client/base.py | 12 ++++++------
src/test/python/apache/aurora/client/api/test_sla.py | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ccd6a492/src/main/python/apache/aurora/client/api/sla.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/sla.py b/src/main/python/apache/aurora/client/api/sla.py
index a20b5d4..0738db8 100644
--- a/src/main/python/apache/aurora/client/api/sla.py
+++ b/src/main/python/apache/aurora/client/api/sla.py
@@ -19,7 +19,7 @@ import time
from collections import defaultdict, namedtuple
from copy import deepcopy
-from apache.aurora.client.base import check_and_log_response
+from apache.aurora.client.base import log_response
from apache.aurora.common.aurora_job_key import AuroraJobKey
from gen.apache.aurora.api.constants import LIVE_STATES
@@ -287,5 +287,7 @@ class Sla(object):
def _get_tasks(self, task_query):
resp = self._scheduler.getTasksStatus(task_query)
- check_and_log_response(resp)
+ log_response(resp)
+ if resp.responseCode != ResponseCode.OK:
+ return []
return resp.result.scheduleStatusResult.tasks
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ccd6a492/src/main/python/apache/aurora/client/base.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/base.py b/src/main/python/apache/aurora/client/base.py
index 13730fd..cc08c18 100644
--- a/src/main/python/apache/aurora/client/base.py
+++ b/src/main/python/apache/aurora/client/base.py
@@ -40,17 +40,17 @@ def die(msg):
log.fatal(msg)
sys.exit(1)
-def check_and_log_response(resp):
+def log_response(resp):
log.info('Response from scheduler: %s (message: %s)'
% (ResponseCode._VALUES_TO_NAMES[resp.responseCode], resp.message))
+
+def check_and_log_response(resp):
+ log_response(resp)
if resp.responseCode != ResponseCode.OK:
- check_and_log_locked_response(resp)
+ if resp.responseCode == ResponseCode.LOCK_ERROR:
+ log.info(LOCKED_WARNING)
sys.exit(1)
-def check_and_log_locked_response(resp):
- if resp.responseCode == ResponseCode.LOCK_ERROR:
- log.info(LOCKED_WARNING)
-
def deprecation_warning(text):
log.warning('')
log.warning('*' * 80)
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ccd6a492/src/test/python/apache/aurora/client/api/test_sla.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_sla.py b/src/test/python/apache/aurora/client/api/test_sla.py
index 86b6775..02b36d5 100644
--- a/src/test/python/apache/aurora/client/api/test_sla.py
+++ b/src/test/python/apache/aurora/client/api/test_sla.py
@@ -302,7 +302,7 @@ class SlaTest(unittest.TestCase):
assert 0 == len(vector.probe_hosts(90, 200))
def test_probe_hosts_no_tasks(self):
- self.mock_get_tasks([])
+ self.mock_get_tasks([], response_code=ResponseCode.INVALID_REQUEST)
vector = self._sla.get_domain_uptime_vector(self._cluster, self._min_count, hosts=['h1', 'h2'])
assert 0 == len(vector.probe_hosts(90, 200))