aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject aurora git commit: Ignore serverInfo on the client side.
Date Fri, 23 Oct 2015 03:13:16 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 8889d8408 -> 84b9d4a4d


Ignore serverInfo on the client side.

The design of this check is flawed - the client has already sent an RPC
to the scheduler and received a response for it, meaning the request has
already been processed and this check only serves to ignore its results.

Reviewed at https://reviews.apache.org/r/39563/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/84b9d4a4
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/84b9d4a4
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/84b9d4a4

Branch: refs/heads/master
Commit: 84b9d4a4dd456279b901b78ba1b361c9d2e92c5f
Parents: 8889d84
Author: Kevin Sweeney <kevints@apache.org>
Authored: Thu Oct 22 20:13:10 2015 -0700
Committer: Kevin Sweeney <kevints@apache.org>
Committed: Thu Oct 22 20:13:10 2015 -0700

----------------------------------------------------------------------
 .../aurora/client/api/scheduler_client.py       |  4 ----
 .../aurora/client/api/test_scheduler_client.py  | 20 ++++----------------
 2 files changed, 4 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/84b9d4a4/src/main/python/apache/aurora/client/api/scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/scheduler_client.py b/src/main/python/apache/aurora/client/api/scheduler_client.py
index 7aa0619..8ff21bf 100644
--- a/src/main/python/apache/aurora/client/api/scheduler_client.py
+++ b/src/main/python/apache/aurora/client/api/scheduler_client.py
@@ -31,7 +31,6 @@ from apache.aurora.common.cluster import Cluster
 from apache.aurora.common.transport import TRequestsTransport
 
 from gen.apache.aurora.api import AuroraAdmin, ReadOnlyScheduler
-from gen.apache.aurora.api.constants import THRIFT_API_VERSION
 from gen.apache.aurora.api.ttypes import ResponseCode, SessionKey
 
 try:
@@ -298,9 +297,6 @@ class SchedulerProxy(object):
             if resp is not None and resp.responseCode == ResponseCode.ERROR_TRANSIENT:
               raise self.TransientError(", ".join(
                   [m.message for m in resp.details] if resp.details else []))
-            if resp.serverInfo.thriftAPIVersion != THRIFT_API_VERSION:
-              raise self.APIVersionError("Client Version: %s, Server Version: %s" %
-                  (THRIFT_API_VERSION, resp.serverInfo.thriftAPIVersion))
             return resp
           except TRequestsTransport.AuthError as e:
             raise self.AuthError(e)

http://git-wip-us.apache.org/repos/asf/aurora/blob/84b9d4a4/src/test/python/apache/aurora/client/api/test_scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_scheduler_client.py b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
index 60d222f..1b4ff9c 100644
--- a/src/test/python/apache/aurora/client/api/test_scheduler_client.py
+++ b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
@@ -31,7 +31,6 @@ from apache.aurora.common.transport import TRequestsTransport
 
 import gen.apache.aurora.api.AuroraAdmin as AuroraAdmin
 import gen.apache.aurora.api.AuroraSchedulerManager as AuroraSchedulerManager
-from gen.apache.aurora.api.constants import THRIFT_API_VERSION
 from gen.apache.aurora.api.ttypes import (
     Hosts,
     JobConfiguration,
@@ -46,7 +45,6 @@ from gen.apache.aurora.api.ttypes import (
     ResponseDetail,
     RewriteConfigsRequest,
     ScheduleStatus,
-    ServerInfo,
     SessionKey,
     TaskQuery
 )
@@ -55,7 +53,7 @@ ROLE = 'foorole'
 JOB_NAME = 'barjobname'
 JOB_ENV = 'devel'
 JOB_KEY = JobKey(role=ROLE, environment=JOB_ENV, name=JOB_NAME)
-DEFAULT_RESPONSE = Response(serverInfo=ServerInfo(thriftAPIVersion=THRIFT_API_VERSION))
+DEFAULT_RESPONSE = Response()
 
 
 def test_coverage():
@@ -165,13 +163,6 @@ class TestSchedulerProxyInjection(unittest.TestCase):
     self.mox.ReplayAll()
     self.make_scheduler_proxy().getQuota(ROLE)
 
-  def test_api_version_mismatch(self):
-    resp = Response(serverInfo=ServerInfo(thriftAPIVersion=THRIFT_API_VERSION + 1))
-    self.mock_thrift_client.getQuota(IgnoreArg()).AndReturn(resp)
-    self.mox.ReplayAll()
-    with pytest.raises(scheduler_client.SchedulerProxy.ThriftInternalError):
-      self.make_scheduler_proxy().getQuota(ROLE)
-
   def test_addInstances(self):
     self.mock_thrift_client.addInstances(
       IsA(JobKey),
@@ -434,12 +425,9 @@ def test_transient_error(_, client):
   mock_thrift_client = mock.create_autospec(spec=AuroraAdmin.Client, instance=True)
   mock_thrift_client.killTasks.side_effect = [
       Response(responseCode=ResponseCode.ERROR_TRANSIENT,
-               details=[ResponseDetail(message="message1"), ResponseDetail(message="message2")],
-               serverInfo=DEFAULT_RESPONSE.serverInfo),
-      Response(responseCode=ResponseCode.ERROR_TRANSIENT,
-               serverInfo=DEFAULT_RESPONSE.serverInfo),
-      Response(responseCode=ResponseCode.OK,
-               serverInfo=DEFAULT_RESPONSE.serverInfo)]
+               details=[ResponseDetail(message="message1"), ResponseDetail(message="message2")]),
+      Response(responseCode=ResponseCode.ERROR_TRANSIENT),
+      Response(responseCode=ResponseCode.OK)]
 
   mock_scheduler_client.get_thrift_client.return_value = mock_thrift_client
   client.get.return_value = mock_scheduler_client


Mime
View raw message