You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by mc...@apache.org on 2014/03/21 15:32:13 UTC

git commit: Die, underscores, die!

Repository: incubator-aurora
Updated Branches:
  refs/heads/master d41987b43 -> d021e7956


Die, underscores, die!

Switch underscores to dashes in clientv2 options.

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


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

Branch: refs/heads/master
Commit: d021e79566d0474ee6134116fc0a04f97abc5be9
Parents: d41987b
Author: Mark Chu-Carroll <mc...@twopensource.com>
Authored: Fri Mar 21 10:30:33 2014 -0400
Committer: Mark Chu-Carroll <mc...@twitter.com>
Committed: Fri Mar 21 10:30:33 2014 -0400

----------------------------------------------------------------------
 src/main/python/apache/aurora/client/cli/jobs.py      | 12 ++++++------
 src/main/python/apache/aurora/client/cli/options.py   | 14 +++++++-------
 src/main/python/apache/aurora/client/cli/sla.py       |  4 ++--
 .../apache/aurora/client/cli/test_cancel_update.py    |  4 ++--
 .../python/apache/aurora/client/cli/test_create.py    |  8 ++++----
 .../python/apache/aurora/client/cli/test_plugins.py   |  2 +-
 .../python/apache/aurora/client/cli/test_quota.py     |  2 +-
 .../python/apache/aurora/client/cli/test_restart.py   |  6 +++---
 src/test/python/apache/aurora/client/cli/test_sla.py  | 10 +++++-----
 9 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/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 2e62519..3a68cf8 100644
--- a/src/main/python/apache/aurora/client/cli/jobs.py
+++ b/src/main/python/apache/aurora/client/cli/jobs.py
@@ -70,7 +70,7 @@ def arg_type_jobkey(key):
 class CancelUpdateCommand(Verb):
   @property
   def name(self):
-    return 'cancel_update'
+    return 'cancel-update'
 
   @property
   def help(self):
@@ -103,7 +103,7 @@ class CreateJobCommand(Verb):
 
   def get_options(self):
     return [BIND_OPTION, JSON_READ_OPTION,
-        CommandOption('--wait_until', choices=self.CREATE_STATES,
+        CommandOption('--wait-until', choices=self.CREATE_STATES,
             default='PENDING',
             help=('Block the client until all the tasks have transitioned into the requested '
                 'state. Default: PENDING')),
@@ -326,15 +326,15 @@ class RestartCommand(Verb):
   def get_options(self):
     return [BATCH_OPTION, BIND_OPTION, BROWSER_OPTION, FORCE_OPTION, HEALTHCHECK_OPTION,
         INSTANCES_OPTION, JSON_READ_OPTION, WATCH_OPTION,
-        CommandOption('--max_per_instance_failures', type=int, default=0,
+        CommandOption('--max-per-instance-failures', type=int, default=0,
              help='Maximum number of restarts per instance during restart. Increments total failure '
                  'count when this limit is exceeded.'),
-        CommandOption('--restart_threshold', type=int, default=60,
+        CommandOption('--restart-threshold', type=int, default=60,
              help='Maximum number of seconds before a shard must move into the RUNNING state '
                  'before considered a failure.'),
-        CommandOption('--max_total_failures', type=int, default=0,
+        CommandOption('--max-total-failures', type=int, default=0,
              help='Maximum number of instance failures to be tolerated in total during restart.'),
-        CommandOption('--rollback_on_failure', default=True, action='store_false',
+        CommandOption('--rollback-on-failure', default=True, action='store_false',
             help='If false, prevent update from performing a rollback.'),
         JOBSPEC_ARGUMENT, CONFIG_ARGUMENT]
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/main/python/apache/aurora/client/cli/options.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/options.py b/src/main/python/apache/aurora/client/cli/options.py
index 0e0bd45..1f33ea2 100644
--- a/src/main/python/apache/aurora/client/cli/options.py
+++ b/src/main/python/apache/aurora/client/cli/options.py
@@ -158,7 +158,7 @@ def parse_task_instance_key(key):
   return TaskInstanceKey(AuroraJobKey(cluster, role, env, name), instance)
 
 
-BATCH_OPTION = CommandOption('--batch_size', type=int, default=5,
+BATCH_OPTION = CommandOption('--batch-size', type=int, default=5,
         help='Number of instances to be operate on in one iteration')
 
 
@@ -178,7 +178,7 @@ CONFIG_ARGUMENT = CommandOption('config_file', type=str,
     help='pathname of the aurora configuration file contain the job specification')
 
 
-EXECUTOR_SANDBOX_OPTION = CommandOption('--executor_sandbox', action='store_true',
+EXECUTOR_SANDBOX_OPTION = CommandOption('--executor-sandbox', action='store_true',
      default=False, help='Run the command in the executor sandbox instead of the task sandbox')
 
 
@@ -186,7 +186,7 @@ FORCE_OPTION = CommandOption('--force', default=False, action='store_true',
     help='Force execution of the command even if there is a warning')
 
 
-HEALTHCHECK_OPTION = CommandOption('--healthcheck_interval_seconds', type=int,
+HEALTHCHECK_OPTION = CommandOption('--healthcheck-interval-seconds', type=int,
     default=3, dest='healthcheck_interval_seconds',
     help='Number of seconds between healthchecks while monitoring update')
 
@@ -203,12 +203,12 @@ JOBSPEC_ARGUMENT = CommandOption('jobspec', type=AuroraJobKey.from_path,
     help='Fully specified job key, in CLUSTER/ROLE/ENV/NAME format')
 
 
-JSON_READ_OPTION = CommandOption('--read_json', default=False, dest='read_json',
+JSON_READ_OPTION = CommandOption('--read-json', default=False, dest='read_json',
     action='store_true',
     help='Read job configuration in json format')
 
 
-JSON_WRITE_OPTION = CommandOption('--write_json', default=False, dest='write_json',
+JSON_WRITE_OPTION = CommandOption('--write-json', default=False, dest='write_json',
     action='store_true',
     help='Generate command output in JSON format')
 
@@ -217,7 +217,7 @@ ROLE_ARGUMENT = CommandOption('role', type=parse_qualified_role, metavar='CLUSTE
     help='Rolename to retrieve information about')
 
 
-SSH_USER_OPTION = CommandOption('--ssh_user', '-l', default=None,
+SSH_USER_OPTION = CommandOption('--ssh-user', '-l', default=None,
     help='ssh as this username instead of the job\'s role')
 
 
@@ -225,7 +225,7 @@ TASK_INSTANCE_ARGUMENT = CommandOption('task_instance', type=parse_task_instance
     help='A task instance specifier, in the form CLUSTER/ROLE/ENV/NAME/INSTANCE')
 
 
-WATCH_OPTION = CommandOption('--watch_secs', type=int, default=30,
+WATCH_OPTION = CommandOption('--watch-secs', type=int, default=30,
     help='Minimum number of seconds a instance must remain in RUNNING state before considered a '
          'success.')
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/main/python/apache/aurora/client/cli/sla.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/sla.py b/src/main/python/apache/aurora/client/cli/sla.py
index 62d1385..67f301a 100644
--- a/src/main/python/apache/aurora/client/cli/sla.py
+++ b/src/main/python/apache/aurora/client/cli/sla.py
@@ -33,7 +33,7 @@ from twitter.common.quantity import Time
 class GetTaskUpCountCmd(Verb):
   @property
   def name(self):
-    return 'get_task_up_count'
+    return 'get-task-up-count'
 
   @property
   def help(self):
@@ -71,7 +71,7 @@ Examples:
 class GetJobUptimeCmd(Verb):
   @property
   def name(self):
-    return 'get_job_uptime'
+    return 'get-job-uptime'
 
   @property
   def help(self):

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/test/python/apache/aurora/client/cli/test_cancel_update.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_cancel_update.py b/src/test/python/apache/aurora/client/cli/test_cancel_update.py
index e5cd7e5..2f86e2e 100644
--- a/src/test/python/apache/aurora/client/cli/test_cancel_update.py
+++ b/src/test/python/apache/aurora/client/cli/test_cancel_update.py
@@ -80,7 +80,7 @@ class TestClientCancelUpdateCommand(AuroraClientCommandTest):
     mock_api.cancel_update.return_value = self.create_simple_success_response()
     with patch('apache.aurora.client.cli.jobs.Job.create_context', return_value=mock_context):
       cmd = AuroraCommandLine()
-      cmd.execute(['job', 'cancel_update', 'west/bozo/test/hello'])
+      cmd.execute(['job', 'cancel-update', 'west/bozo/test/hello'])
       self.assert_cancel_update_called(mock_api)
 
   @classmethod
@@ -106,7 +106,7 @@ class TestClientCancelUpdateCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        cmd.execute(['job', 'cancel_update', 'west/mchucarroll/test/hello'])
+        cmd.execute(['job', 'cancel-update', 'west/mchucarroll/test/hello'])
 
       # All that cancel_update really does is release the update lock.
       # So that's all we really need to check.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/test/python/apache/aurora/client/cli/test_create.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_create.py b/src/test/python/apache/aurora/client/cli/test_create.py
index 4fff616..6f8d91e 100644
--- a/src/test/python/apache/aurora/client/cli/test_create.py
+++ b/src/test/python/apache/aurora/client/cli/test_create.py
@@ -116,7 +116,7 @@ class TestClientCreateCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        cmd.execute(['job', 'create', '--wait_until=RUNNING', 'west/bozo/test/hello',
+        cmd.execute(['job', 'create', '--wait-until=RUNNING', 'west/bozo/test/hello',
             fp.name])
 
       # Now check that the right API calls got made.
@@ -142,7 +142,7 @@ class TestClientCreateCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        cmd.execute(['job', 'create', '--wait_until=RUNNING', 'west/bozo/test/hello',
+        cmd.execute(['job', 'create', '--wait-until=RUNNING', 'west/bozo/test/hello',
             fp.name])
         # Now check that the right API calls got made.
         # Check that create_job was called exactly once, with an AuroraConfig parameter.
@@ -164,7 +164,7 @@ class TestClientCreateCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        result = cmd.execute(['job', 'create', '--wait_until=RUNNING',
+        result = cmd.execute(['job', 'create', '--wait-until=RUNNING',
             'west/bozo/test/hello', fp.name])
         assert result == EXIT_COMMAND_FAILURE
 
@@ -184,7 +184,7 @@ class TestClientCreateCommand(AuroraClientCommandTest):
         fp.write(self.get_invalid_config('invalid_clause=oops'))
         fp.flush()
         cmd = AuroraCommandLine()
-        result = cmd.execute(['job', 'create', '--wait_until=RUNNING',
+        result = cmd.execute(['job', 'create', '--wait-until=RUNNING',
             'west/bozo/test/hello', fp.name])
         assert result == EXIT_INVALID_CONFIGURATION
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/test/python/apache/aurora/client/cli/test_plugins.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_plugins.py b/src/test/python/apache/aurora/client/cli/test_plugins.py
index b36e5f1..7cacb02 100644
--- a/src/test/python/apache/aurora/client/cli/test_plugins.py
+++ b/src/test/python/apache/aurora/client/cli/test_plugins.py
@@ -123,7 +123,7 @@ class TestPlugins(AuroraClientCommandTest):
         fp.flush()
         cmd = AuroraCommandLine()
         cmd.register_plugin(BogusPlugin())
-        cmd.execute(['job', 'create', '--bogosity=maximum', '--wait_until=RUNNING',
+        cmd.execute(['job', 'create', '--bogosity=maximum', '--wait-until=RUNNING',
             'west/bozo/test/hello', fp.name])
 
       # Now check that the right API calls got made.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/test/python/apache/aurora/client/cli/test_quota.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_quota.py b/src/test/python/apache/aurora/client/cli/test_quota.py
index 44afd74..26cf302 100644
--- a/src/test/python/apache/aurora/client/cli/test_quota.py
+++ b/src/test/python/apache/aurora/client/cli/test_quota.py
@@ -85,6 +85,6 @@ class TestGetQuotaCommand(AuroraClientCommandTest):
         patch('apache.aurora.client.cli.quota.Quota.create_context', return_value=mock_context),
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
-      cmd.execute(['quota', 'get', '--write_json', 'west/bozo'])
+      cmd.execute(['quota', 'get', '--write-json', 'west/bozo'])
       out = '\n'.join(mock_context.get_out())
       assert out == '{"quota":{"numCpus":5,"ramMb":20480,"diskMb":40960}}'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/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 aa23d5b..7547bd7 100644
--- a/src/test/python/apache/aurora/client/cli/test_restart.py
+++ b/src/test/python/apache/aurora/client/cli/test_restart.py
@@ -81,7 +81,7 @@ class TestRestartCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        cmd.execute(['job', 'restart', '--batch_size=5', 'west/bozo/test/hello', fp.name])
+        cmd.execute(['job', 'restart', '--batch-size=5', 'west/bozo/test/hello', fp.name])
 
         # Like the update test, the exact number of calls here doesn't matter.
         # what matters is that it must have been called once before batching, plus
@@ -111,7 +111,7 @@ class TestRestartCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        result = cmd.execute(['job', 'restart', '--batch_size=5', 'west/bozo/test/hello', fp.name])
+        result = cmd.execute(['job', 'restart', '--batch-size=5', 'west/bozo/test/hello', fp.name])
         assert mock_scheduler_proxy.getTasksStatus.call_count == 1
         assert mock_scheduler_proxy.restartShards.call_count == 0
         assert result == EXIT_API_ERROR
@@ -134,7 +134,7 @@ class TestRestartCommand(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        result = cmd.execute(['job', 'restart', '--batch_size=5', 'west/bozo/test/hello', fp.name])
+        result = cmd.execute(['job', 'restart', '--batch-size=5', 'west/bozo/test/hello', fp.name])
         assert mock_scheduler_proxy.getTasksStatus.call_count == 1
         assert mock_scheduler_proxy.restartShards.call_count == 1
         mock_scheduler_proxy.restartShards.assert_called_with(JobKey(environment=self.TEST_ENV,

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/d021e795/src/test/python/apache/aurora/client/cli/test_sla.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_sla.py b/src/test/python/apache/aurora/client/cli/test_sla.py
index 46f3e8d..7d0381c 100644
--- a/src/test/python/apache/aurora/client/cli/test_sla.py
+++ b/src/test/python/apache/aurora/client/cli/test_sla.py
@@ -37,7 +37,7 @@ class TestGetTaskUpCountCommand(AuroraClientCommandTest):
         patch('apache.aurora.client.cli.sla.Sla.create_context', return_value=mock_context),
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
-      cmd.execute(['sla', 'get_task_up_count', 'west/role/env/test'])
+      cmd.execute(['sla', 'get-task-up-count', 'west/role/env/test'])
       out = '\n'.join(mock_context.get_out())
       assert '1 mins\t- 10.65 %\n' in out
       assert '10 mins\t- 10.65 %\n' in out
@@ -52,7 +52,7 @@ class TestGetTaskUpCountCommand(AuroraClientCommandTest):
         patch('apache.aurora.client.cli.sla.Sla.create_context', return_value=mock_context),
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
-      cmd.execute(['sla', 'get_task_up_count', 'west/role/env/test', '--durations=3m,2d6h,3h'])
+      cmd.execute(['sla', 'get-task-up-count', 'west/role/env/test', '--durations=3m,2d6h,3h'])
       out = '\n'.join(mock_context.get_out())
       assert '3 mins\t- 95.36 %' in out
       assert '54 hrs\t- 95.36 %' in out
@@ -74,7 +74,7 @@ class TestGetJobUptimeCommand(AuroraClientCommandTest):
         patch('apache.aurora.client.cli.sla.Sla.create_context', return_value=mock_context),
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
-      cmd.execute(['sla', 'get_job_uptime', 'west/role/env/test'])
+      cmd.execute(['sla', 'get-job-uptime', 'west/role/env/test'])
       out = '\n'.join(mock_context.get_out())
       assert '99.0 percentile\t- 915 seconds' in out
       assert '95.0 percentile\t- 915 seconds' in out
@@ -93,7 +93,7 @@ class TestGetJobUptimeCommand(AuroraClientCommandTest):
         patch('apache.aurora.client.cli.sla.Sla.create_context', return_value=mock_context),
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
-      cmd.execute(['sla', 'get_job_uptime', 'west/role/env/test', '--percentiles=99.9,85.5'])
+      cmd.execute(['sla', 'get-job-uptime', 'west/role/env/test', '--percentiles=99.9,85.5'])
       out = '\n'.join(mock_context.get_out())
       assert '99.9 percentile\t- 915 seconds' in out
       assert '85.5 percentile\t- 915 seconds' in out
@@ -101,7 +101,7 @@ class TestGetJobUptimeCommand(AuroraClientCommandTest):
   def test_invalid_percentile(self):
     cmd = AuroraCommandLine()
     try:
-      cmd.execute(['sla', 'get_job_uptime', 'west/role/env/test', '--percentiles=100'])
+      cmd.execute(['sla', 'get-job-uptime', 'west/role/env/test', '--percentiles=100'])
     except SystemExit:
       pass
     else: