aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Renaming packages to packagesDEPRECATED in client.
Date Tue, 18 Mar 2014 00:08:05 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 2542f7be0 -> 6c1d4027f


Renaming packages to packagesDEPRECATED in client.

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


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

Branch: refs/heads/master
Commit: 6c1d4027ff1fd57bc335b549bfb598a277fde8bb
Parents: 2542f7b
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Mon Mar 17 17:07:40 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Mon Mar 17 17:07:40 2014 -0700

----------------------------------------------------------------------
 .../python/apache/aurora/client/cli/jobs.py     |  4 +--
 .../apache/aurora/client/commands/core.py       | 10 +++---
 src/main/python/apache/aurora/config/thrift.py  |  2 +-
 .../apache/aurora/client/api/test_updater.py    |  6 ++--
 .../apache/aurora/client/cli/test_diff.py       |  2 +-
 .../apache/aurora/client/cli/test_status.py     |  4 +--
 .../apache/aurora/client/cli/test_task_run.py   |  4 +--
 .../apache/aurora/client/commands/test_diff.py  |  2 +-
 .../apache/aurora/client/commands/test_run.py   |  2 +-
 .../apache/aurora/client/commands/test_ssh.py   |  2 +-
 .../aurora/client/commands/test_status.py       | 34 +++++++++++++++++++-
 .../python/apache/aurora/config/test_thrift.py  |  6 ++--
 12 files changed, 56 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/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 b9d4e83..2e62519 100644
--- a/src/main/python/apache/aurora/client/cli/jobs.py
+++ b/src/main/python/apache/aurora/client/cli/jobs.py
@@ -409,8 +409,8 @@ The jobspec parameter can omit parts of the jobkey, or use shell-style
globs."""
         task_strings.append('\t %s %s: %s' % (datetime.fromtimestamp(event.timestamp / 1000),
             ScheduleStatus._VALUES_TO_NAMES[event.status], event.message))
         task_strings.append('packages:')
-        if assigned_task.task.packages is not None:
-          for pkg in assigned_task.task.packages:
+        if assigned_task.task.packagesDEPRECATED is not None:
+          for pkg in assigned_task.task.packagesDEPRECATED:
             task_strings.append('\trole: %s, package: %s, version: %s' %
                 (pkg.role, pkg.name, pkg.version))
       return '\n\t'.join(task_strings)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/main/python/apache/aurora/client/commands/core.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/commands/core.py b/src/main/python/apache/aurora/client/commands/core.py
index 49fab9f..9977c72 100644
--- a/src/main/python/apache/aurora/client/commands/core.py
+++ b/src/main/python/apache/aurora/client/commands/core.py
@@ -436,8 +436,9 @@ def status(args, options):
                                           ScheduleStatus._VALUES_TO_NAMES[event.status],
                                           event.message)
     taskString += '\n\tpackages:'
-    for pkg in assigned_task.task.packages:
-      taskString += ('\n\t\trole: %s, package: %s, version: %s' % (pkg.role, pkg.name, pkg.version))
+    if assigned_task.task.packagesDEPRECATED is not None:
+      for pkg in assigned_task.task.packagesDEPRECATED:
+        taskString += ('\n\t\trole: %s, package: %s, version: %s' % (pkg.role, pkg.name,
pkg.version))
 
     return taskString
 
@@ -453,8 +454,9 @@ def status(args, options):
               ScheduleStatus._VALUES_TO_NAMES[task.status],
               task.assignedTask.slaveHost,
               taskString))
-      for pkg in task.assignedTask.task.packages:
-        log.info('\tpackage %s/%s/%s' % (pkg.role, pkg.name, pkg.version))
+      if task.assignedTask.task.packagesDEPRECATED is not None:
+        for pkg in task.assignedTask.task.packagesDEPRECATED:
+          log.info('\tpackage %s/%s/%s' % (pkg.role, pkg.name, pkg.version))
 
   api, job_key, _ = LiveJobDisambiguator.disambiguate_args_or_die(
       args, options, make_client_factory())

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/main/python/apache/aurora/config/thrift.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/config/thrift.py b/src/main/python/apache/aurora/config/thrift.py
index 65b9626..47f592f 100644
--- a/src/main/python/apache/aurora/config/thrift.py
+++ b/src/main/python/apache/aurora/config/thrift.py
@@ -211,7 +211,7 @@ def convert(job, packages=frozenset(), ports=frozenset()):
   task.contactEmail = not_empty_or(job.contact(), None)
 
   # Add package tuples to a task, to display in the scheduler UI.
-  task.packages = frozenset(
+  task.packagesDEPRECATED = frozenset(
       Package(role=str(role), name=str(package_name), version=int(version))
       for role, package_name, version in packages)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/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 c3e259c..4a4971d 100644
--- a/src/test/python/apache/aurora/client/api/test_updater.py
+++ b/src/test/python/apache/aurora/client/api/test_updater.py
@@ -755,9 +755,9 @@ class UpdaterTest(TestCase):
         Constraint(name='value', constraint=ValueConstraint(values=set(['1', '2']))),
         Constraint(name='limit', constraint=TaskConstraint(limit=LimitConstraint(limit=int(10))))])
     from_config.taskLinks = {'task1': 'link1', 'task2': 'link2'}
-    from_config.packages = set([
-      Package(name='n2', role='r2', version=4),
-      Package(role='r1', name='n1', version=1)])
+    from_config.packagesDEPRECATED = set([
+        Package(name='n2', role='r2', version=4),
+        Package(role='r1', name='n1', version=1)])
     from_config.executorConfig = ExecutorConfig(name='test', data='test data')
     from_config.requestedPorts = set(['3424', '142', '45235'])
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/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 758b37e..f81e51d 100644
--- a/src/test/python/apache/aurora/client/cli/test_diff.py
+++ b/src/test/python/apache/aurora/client/cli/test_diff.py
@@ -71,7 +71,7 @@ class TestDiffCommand(AuroraClientCommandTest):
       job.assignedTask.task.maxTaskFailures = 1
       job.assignedTask.task.executorConfig = Mock(spec=ExecutorConfig)
       job.assignedTask.task.executorConfig.data = Mock()
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='bozo')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/cli/test_status.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_status.py b/src/test/python/apache/aurora/client/cli/test_status.py
index 1d8d9b3..e828f27 100644
--- a/src/test/python/apache/aurora/client/cli/test_status.py
+++ b/src/test/python/apache/aurora/client/cli/test_status.py
@@ -50,7 +50,7 @@ class TestJobStatus(AuroraClientCommandTest):
       job.assignedTask.slaveHost = 'slavehost'
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='bozo')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'
@@ -72,7 +72,7 @@ class TestJobStatus(AuroraClientCommandTest):
   def create_mock_scheduled_task_no_packages(cls):
     result = cls.create_mock_scheduled_tasks()
     for job in result:
-      job.assignedTask.task.packages = None
+      job.assignedTask.task.packagesDEPRECATED = None
     return result
 
   @classmethod

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/cli/test_task_run.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_task_run.py b/src/test/python/apache/aurora/client/cli/test_task_run.py
index 56eed95..98dc52d 100644
--- a/src/test/python/apache/aurora/client/cli/test_task_run.py
+++ b/src/test/python/apache/aurora/client/cli/test_task_run.py
@@ -50,7 +50,7 @@ class TestRunCommand(AuroraClientCommandTest):
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.executorConfig = Mock()
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='bozo')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'
@@ -134,7 +134,7 @@ class TestSshCommand(AuroraClientCommandTest):
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.executorConfig = Mock()
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='bozo')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/commands/test_diff.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/test_diff.py b/src/test/python/apache/aurora/client/commands/test_diff.py
index 730f802..fc15421 100644
--- a/src/test/python/apache/aurora/client/commands/test_diff.py
+++ b/src/test/python/apache/aurora/client/commands/test_diff.py
@@ -68,7 +68,7 @@ class TestDiffCommand(AuroraClientCommandTest):
       job.assignedTask.task.maxTaskFailures = 1
       job.assignedTask.task.executorConfig = Mock(spec=ExecutorConfig)
       job.assignedTask.task.executorConfig.data = Mock()
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='mchucarroll')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/commands/test_run.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/test_run.py b/src/test/python/apache/aurora/client/commands/test_run.py
index bfb9ecc..fe66615 100644
--- a/src/test/python/apache/aurora/client/commands/test_run.py
+++ b/src/test/python/apache/aurora/client/commands/test_run.py
@@ -60,7 +60,7 @@ class TestRunCommand(AuroraClientCommandTest):
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.executorConfig = Mock()
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='mchucarroll')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/commands/test_ssh.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/test_ssh.py b/src/test/python/apache/aurora/client/commands/test_ssh.py
index 86402f6..2fe12ef 100644
--- a/src/test/python/apache/aurora/client/commands/test_ssh.py
+++ b/src/test/python/apache/aurora/client/commands/test_ssh.py
@@ -59,7 +59,7 @@ class TestSshCommand(AuroraClientCommandTest):
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.executorConfig = Mock()
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='mchucarroll')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/client/commands/test_status.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/test_status.py b/src/test/python/apache/aurora/client/commands/test_status.py
index b63f794..eed798d 100644
--- a/src/test/python/apache/aurora/client/commands/test_status.py
+++ b/src/test/python/apache/aurora/client/commands/test_status.py
@@ -57,7 +57,7 @@ class TestListJobs(AuroraClientCommandTest):
       job.assignedTask.slaveHost = 'slavehost'
       job.assignedTask.task = Mock(spec=TaskConfig)
       job.assignedTask.task.maxTaskFailures = 1
-      job.assignedTask.task.packages = []
+      job.assignedTask.task.packagesDEPRECATED = []
       job.assignedTask.task.owner = Identity(role='mchucarroll')
       job.assignedTask.task.environment = 'test'
       job.assignedTask.task.jobName = 'woops'
@@ -76,6 +76,13 @@ class TestListJobs(AuroraClientCommandTest):
     return jobs
 
   @classmethod
+  def create_mock_scheduled_task_no_packages(cls):
+    result = cls.create_mock_scheduled_tasks()
+    for job in result:
+      job.assignedTask.task.packagesDEPRECATED = None
+    return result
+
+  @classmethod
   def create_status_response(cls):
     resp = cls.create_simple_success_response()
     resp.result.scheduleStatusResult = Mock(spec=ScheduleStatusResult)
@@ -83,6 +90,13 @@ class TestListJobs(AuroraClientCommandTest):
     return resp
 
   @classmethod
+  def create_status_response_null_package(cls):
+    resp = cls.create_simple_success_response()
+    resp.result.scheduleStatusResult = Mock(spec=ScheduleStatusResult)
+    resp.result.scheduleStatusResult.tasks = set(cls.create_mock_scheduled_task_no_packages())
+    return resp
+
+  @classmethod
   def create_failed_status_response(cls):
     return cls.create_blank_response(ResponseCode.INVALID_REQUEST, 'No tasks found for query')
 
@@ -123,3 +137,21 @@ class TestListJobs(AuroraClientCommandTest):
 
       mock_scheduler_proxy.getTasksStatus.assert_called_with(TaskQuery(jobName='hello',
           environment='test', owner=Identity(role='mchucarroll')))
+
+  def test_successful_status_nopackages(self):
+    """Test the status command with no packages."""
+    # Calls api.check_status, which calls scheduler_proxy.getJobs
+    mock_options = self.setup_mock_options()
+    (mock_api, mock_scheduler_proxy) = self.create_mock_api()
+    mock_scheduler_proxy.getTasksStatus.return_value = self.create_status_response_null_package()
+    with contextlib.nested(
+        patch('apache.aurora.client.api.SchedulerProxy', return_value=mock_scheduler_proxy),
+        patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS),
+        patch('twitter.common.app.get_options', return_value=mock_options)) as (
+      mock_scheduler_proxy_class,
+      mock_clusters,
+      options):
+      status(['west/mchucarroll/test/hello'], mock_options)
+
+      mock_scheduler_proxy.getTasksStatus.assert_called_with(TaskQuery(jobName='hello',
+          environment='test', owner=Identity(role='mchucarroll')))

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6c1d4027/src/test/python/apache/aurora/config/test_thrift.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/config/test_thrift.py b/src/test/python/apache/aurora/config/test_thrift.py
index 4be11b5..3acd4cc 100644
--- a/src/test/python/apache/aurora/config/test_thrift.py
+++ b/src/test/python/apache/aurora/config/test_thrift.py
@@ -79,7 +79,7 @@ def test_simple_config():
   assert tti.priority == 0
   assert tti.maxTaskFailures == 1
   assert tti.constraints == set()
-  assert tti.packages == set()
+  assert tti.packagesDEPRECATED == set()
   assert tti.environment == HELLO_WORLD.environment().get()
 
 
@@ -212,8 +212,8 @@ def test_packages_in_config():
   assert job.instanceCount == 1
   tti = job.taskConfig
 
-  assert len(tti.packages) == 1
-  pi = iter(tti.packages).next()
+  assert len(tti.packagesDEPRECATED) == 1
+  pi = iter(tti.packagesDEPRECATED).next()
   assert pi.role == 'alpha'
   assert pi.name == 'beta'
   assert pi.version == 1


Mime
View raw message