aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Remove the populatedDEPRECATED thrift field.
Date Tue, 17 Mar 2015 01:20:56 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 1b2a343c6 -> 2f991069e


Remove the populatedDEPRECATED thrift field.

Bugs closed: AURORA-975

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


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

Branch: refs/heads/master
Commit: 2f991069e60e47ddbbaf1d60d6403922bbb0e208
Parents: 1b2a343
Author: Bill Farner <wfarner@apache.org>
Authored: Mon Mar 16 18:20:34 2015 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Mar 16 18:20:34 2015 -0700

----------------------------------------------------------------------
 api/src/main/thrift/org/apache/aurora/gen/api.thrift     |  2 --
 .../aurora/scheduler/thrift/ReadOnlySchedulerImpl.java   |  8 ++------
 src/main/python/apache/aurora/client/api/updater.py      |  4 ++--
 src/main/python/apache/aurora/client/base.py             |  9 ---------
 src/main/python/apache/aurora/client/cli/jobs.py         |  5 +++--
 .../scheduler/thrift/ReadOnlySchedulerImplTest.java      | 11 +++++------
 src/test/python/apache/aurora/client/api/test_updater.py |  5 +----
 src/test/python/apache/aurora/client/cli/test_diff.py    |  5 +----
 src/test/python/apache/aurora/client/cli/test_restart.py |  5 +----
 src/test/python/apache/aurora/client/cli/test_update.py  |  9 +++------
 src/test/python/apache/aurora/client/test_base.py        |  8 +-------
 11 files changed, 19 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/api/src/main/thrift/org/apache/aurora/gen/api.thrift
----------------------------------------------------------------------
diff --git a/api/src/main/thrift/org/apache/aurora/gen/api.thrift b/api/src/main/thrift/org/apache/aurora/gen/api.thrift
index 8386ee3..2cbbed0 100644
--- a/api/src/main/thrift/org/apache/aurora/gen/api.thrift
+++ b/api/src/main/thrift/org/apache/aurora/gen/api.thrift
@@ -342,8 +342,6 @@ struct ConfigSummary {
 }
 
 struct PopulateJobResult {
-  // TODO(maxim): Remove populated field in 0.7.0. (AURORA-691)
-  1: set<TaskConfig> populatedDEPRECATED
   2: TaskConfig taskConfig
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java b/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
index 3876290..7aef1ca 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImpl.java
@@ -139,12 +139,8 @@ class ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface {
     try {
       ITaskConfig populatedTaskConfig = SanitizedConfiguration.fromUnsanitized(
           IJobConfiguration.build(description)).getJobConfig().getTaskConfig();
-
-      PopulateJobResult result = new PopulateJobResult()
-          .setPopulatedDEPRECATED(ImmutableSet.of(populatedTaskConfig.newBuilder()))
-          .setTaskConfig(populatedTaskConfig.newBuilder());
-
-      return ok(Result.populateJobResult(result));
+      return ok(Result.populateJobResult(
+          new PopulateJobResult().setTaskConfig(populatedTaskConfig.newBuilder())));
     } catch (TaskDescriptionException e) {
       return invalidRequest("Invalid configuration: " + e.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/main/python/apache/aurora/client/api/updater.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/updater.py b/src/main/python/apache/aurora/client/api/updater.py
index 7fd6fda..acbce21 100644
--- a/src/main/python/apache/aurora/client/api/updater.py
+++ b/src/main/python/apache/aurora/client/api/updater.py
@@ -24,7 +24,7 @@ from thrift.TSerialization import serialize
 from twitter.common import log
 from twitter.common.quantity import Amount, Time
 
-from apache.aurora.client.base import combine_messages, format_response, get_populated_task_config
+from apache.aurora.client.base import combine_messages, format_response
 
 from .error_handling_thread import ExecutionError, spawn_worker
 from .instance_watcher import InstanceWatcher
@@ -628,7 +628,7 @@ class Updater(object):
     """
     resp = self._scheduler.populateJobConfig(self._config.job())
     self._check_and_log_response(resp)
-    return get_populated_task_config(resp)
+    return resp.result.populateJobResult.taskConfig
 
   def _replace_template_if_cron(self):
     """Checks if the provided job config represents a cron job and if so, replaces it.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/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 352d3f0..c72f2f7 100644
--- a/src/main/python/apache/aurora/client/base.py
+++ b/src/main/python/apache/aurora/client/base.py
@@ -68,15 +68,6 @@ def check_and_log_locked_response(resp):
     log.info(LOCKED_WARNING)
 
 
-def get_populated_task_config(resp):
-  """Temporary dual read until AURORA-975 is addressed."""
-  result = resp.result.populateJobResult
-  if result.taskConfig:
-    return result.taskConfig
-  else:
-    return list(result.populatedDEPRECATED)[0] if result.populatedDEPRECATED else None
-
-
 def deprecation_warning(text):
   log.warning('')
   log.warning('*' * 80)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/main/python/apache/aurora/client/cli/jobs.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/jobs.py b/src/main/python/apache/aurora/client/cli/jobs.py
index d6633d9..61337b9 100644
--- a/src/main/python/apache/aurora/client/cli/jobs.py
+++ b/src/main/python/apache/aurora/client/cli/jobs.py
@@ -31,7 +31,6 @@ from thrift.TSerialization import serialize
 
 from apache.aurora.client.api.job_monitor import JobMonitor
 from apache.aurora.client.api.updater_util import UpdaterConfig
-from apache.aurora.client.base import get_populated_task_config
 from apache.aurora.client.cli import (
     EXIT_COMMAND_FAILURE,
     EXIT_INVALID_CONFIGURATION,
@@ -226,7 +225,9 @@ class DiffCommand(Verb):
     context.log_response_and_raise(resp, err_code=EXIT_INVALID_CONFIGURATION,
           err_msg="Error loading configuration")
     # Deepcopy is important here as tasks will be modified for printing.
-    local_tasks = [deepcopy(get_populated_task_config(resp)) for _ in range(config.instances())]
+    local_tasks = [
+      deepcopy(resp.result.populateJobResult.taskConfig) for _ in range(config.instances())
+    ]
     diff_program = os.environ.get("DIFF_VIEWER", "diff")
     with NamedTemporaryFile() as local:
       self.dump_tasks(local_tasks, local)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
index 3cf8dfd..52c7262 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
@@ -42,9 +42,11 @@ import org.apache.aurora.gen.JobUpdateDetails;
 import org.apache.aurora.gen.JobUpdateQuery;
 import org.apache.aurora.gen.JobUpdateSummary;
 import org.apache.aurora.gen.PendingReason;
+import org.apache.aurora.gen.PopulateJobResult;
 import org.apache.aurora.gen.ReadOnlyScheduler;
 import org.apache.aurora.gen.ResourceAggregate;
 import org.apache.aurora.gen.Response;
+import org.apache.aurora.gen.Result;
 import org.apache.aurora.gen.RoleSummary;
 import org.apache.aurora.gen.RoleSummaryResult;
 import org.apache.aurora.gen.ScheduleStatus;
@@ -262,12 +264,9 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
 
     Response response = assertOkResponse(thrift.populateJobConfig(job.newBuilder()));
     assertEquals(
-        ImmutableSet.of(sanitized.getJobConfig().getTaskConfig().newBuilder()),
-        response.getResult().getPopulateJobResult().getPopulatedDEPRECATED());
-
-    assertEquals(
-        sanitized.getJobConfig().getTaskConfig().newBuilder(),
-        response.getResult().getPopulateJobResult().getTaskConfig());
+        Result.populateJobResult(new PopulateJobResult(
+            sanitized.getJobConfig().getTaskConfig().newBuilder())),
+        response.getResult());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/python/apache/aurora/client/api/test_updater.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_updater.py b/src/test/python/apache/aurora/client/api/test_updater.py
index 7f3bc28..8793555 100644
--- a/src/test/python/apache/aurora/client/api/test_updater.py
+++ b/src/test/python/apache/aurora/client/api/test_updater.py
@@ -198,10 +198,7 @@ class UpdaterTest(TestCase):
   def expect_populate(self, job_config, response_code=ResponseCode.OK):
     resp = make_response(response_code)
     config = deepcopy(job_config.taskConfig)
-    result = set([config])
-    resp.result = Result(populateJobResult=PopulateJobResult(
-        populatedDEPRECATED=result,
-        taskConfig=config))
+    resp.result = Result(populateJobResult=PopulateJobResult(taskConfig=config))
 
     self._scheduler.populateJobConfig(job_config).AndReturn(resp)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/python/apache/aurora/client/cli/test_diff.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_diff.py b/src/test/python/apache/aurora/client/cli/test_diff.py
index 054e6fb..c8b27a4 100644
--- a/src/test/python/apache/aurora/client/cli/test_diff.py
+++ b/src/test/python/apache/aurora/client/cli/test_diff.py
@@ -63,11 +63,8 @@ class TestDiffCommand(AuroraClientCommandTest):
   def setup_populate_job_config(cls, api):
     populate = cls.create_simple_success_response()
     api.populateJobConfig.return_value = populate
-    tasks = set(task.assignedTask.task for task in cls.create_scheduled_tasks())
     populate.result = Result(populateJobResult=PopulateJobResult(
-        populatedDEPRECATED=tasks,
-        taskConfig=list(tasks)[0]
-    ))
+        taskConfig=cls.create_scheduled_tasks()[0].assignedTask.task))
     return populate
 
   def test_successful_diff(self):

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/python/apache/aurora/client/cli/test_restart.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_restart.py b/src/test/python/apache/aurora/client/cli/test_restart.py
index 4f20f6b..fb5491d 100644
--- a/src/test/python/apache/aurora/client/cli/test_restart.py
+++ b/src/test/python/apache/aurora/client/cli/test_restart.py
@@ -92,10 +92,7 @@ class TestRestartCommand(AuroraClientCommandTest):
   @classmethod
   def setup_populate_job_config(cls, api):
     populate = cls.create_simple_success_response()
-    populate.result = Result(populateJobResult=PopulateJobResult(
-        populatedDEPRECATED={TaskConfig()},
-        taskConfig=TaskConfig()
-    ))
+    populate.result = Result(populateJobResult=PopulateJobResult(taskConfig=TaskConfig()))
     api.populateJobConfig.return_value = populate
     return populate
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/python/apache/aurora/client/cli/test_update.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_update.py b/src/test/python/apache/aurora/client/cli/test_update.py
index 9bfbbea..cc74585 100644
--- a/src/test/python/apache/aurora/client/cli/test_update.py
+++ b/src/test/python/apache/aurora/client/cli/test_update.py
@@ -224,15 +224,12 @@ class TestUpdateCommand(AuroraClientCommandTest):
   @classmethod
   def setup_populate_job_config(cls, api, count=20):
     populate = cls.create_simple_success_response()
-    configs = [TaskConfig(
+    config = TaskConfig(
         numCpus=1.0,
         ramMb=1,
         diskMb=1,
-        job=JobKey(role='bozo', environment='test', name='hello')) for i in range(count)]
-    populate.result = Result(populateJobResult=PopulateJobResult(
-        populatedDEPRECATED=set(configs),
-        taskConfig=configs[0]
-    ))
+        job=JobKey(role='bozo', environment='test', name='hello'))
+    populate.result = Result(populateJobResult=PopulateJobResult(taskConfig=config))
     api.populateJobConfig.return_value = populate
     return populate
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/2f991069/src/test/python/apache/aurora/client/test_base.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/test_base.py b/src/test/python/apache/aurora/client/test_base.py
index 06c0b43..1a56008 100644
--- a/src/test/python/apache/aurora/client/test_base.py
+++ b/src/test/python/apache/aurora/client/test_base.py
@@ -55,10 +55,4 @@ class TestBase(unittest.TestCase):
     config = TaskConfig()
     resp = Response(responseCode=ResponseCode.OK, result=Result(populateJobResult=PopulateJobResult(
         taskConfig=config)))
-    assert config == base.get_populated_task_config(resp)
-
-  def test_get_populated_task_config_deprecated_set(self):
-    config = TaskConfig()
-    resp = Response(responseCode=ResponseCode.OK, result=Result(populateJobResult=PopulateJobResult(
-        populatedDEPRECATED=set([config]))))
-    assert config == base.get_populated_task_config(resp)
+    assert config == resp.result.populateJobResult.taskConfig


Mime
View raw message