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/06/05 15:31:38 UTC

git commit: Add a target for a standalone v2 client.

Repository: incubator-aurora
Updated Branches:
  refs/heads/master 93f7a46e5 -> ca4adf93f


Add a target for a standalone v2 client.

This adds a new target, "src/main/python/apache/aurora/client/cli:aurora2_so",
which builds an executable for a non-bridged, standalone aurora client.

Bugs closed: aurora-505

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


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

Branch: refs/heads/master
Commit: ca4adf93ff5df8f86a7e453189787ba78e9d4ccc
Parents: 93f7a46
Author: Mark Chu-Carroll <mc...@twopensource.com>
Authored: Thu Jun 5 09:20:32 2014 -0400
Committer: Mark Chu-Carroll <mc...@twitter.com>
Committed: Thu Jun 5 09:20:32 2014 -0400

----------------------------------------------------------------------
 src/main/python/apache/aurora/client/cli/BUILD  | 11 +++-
 .../python/apache/aurora/client/cli/client.py   | 27 ++--------
 .../aurora/client/cli/standalone_client.py      | 53 ++++++++++++++++++++
 3 files changed, 68 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ca4adf93/src/main/python/apache/aurora/client/cli/BUILD
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/BUILD b/src/main/python/apache/aurora/client/cli/BUILD
index 1c71d38..ebe681a 100644
--- a/src/main/python/apache/aurora/client/cli/BUILD
+++ b/src/main/python/apache/aurora/client/cli/BUILD
@@ -20,6 +20,14 @@ python_binary(
   ],
 )
 
+python_binary(
+  name='aurora2_so',
+  entry_point = 'apache.aurora.client.cli.standalone_client:proxy_main',
+  dependencies = [
+    pants(':client_lib')
+  ]
+)
+
 python_library(
   name = 'bridge',
   sources = ['bridge.py']
@@ -49,8 +57,9 @@ python_library(
     'logsetup.py',
     'options.py',
     'quota.py',
+    'standalone_client.py',
     'sla.py',
-    'task.py'
+    'task.py',
   ],
   dependencies = [
     pants('3rdparty/python:argparse'),

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ca4adf93/src/main/python/apache/aurora/client/cli/client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/client.py b/src/main/python/apache/aurora/client/cli/client.py
index 1fb5364..fa21576 100644
--- a/src/main/python/apache/aurora/client/cli/client.py
+++ b/src/main/python/apache/aurora/client/cli/client.py
@@ -16,31 +16,14 @@ import sys
 from apache.aurora.client.cli import CommandLine
 from apache.aurora.client.cli.bridge import Bridge, CommandProcessor
 from apache.aurora.client.cli.logsetup import setup_default_log_handlers
+from apache.aurora.client.cli.standalone_client import AuroraCommandLine
 import logging
 
 
-class AuroraCommandLine(CommandLine):
-  """The CommandLine implementation for the Aurora client v2 command line."""
-
-  @classmethod
-  def get_description(cls):
-    return 'Aurora client command line'
-
-  def register_nouns(self):
-    super(AuroraCommandLine, self).register_nouns()
-    from apache.aurora.client.cli.cron import CronNoun
-    self.register_noun(CronNoun())
-    from apache.aurora.client.cli.jobs import Job
-    self.register_noun(Job())
-    from apache.aurora.client.cli.config import ConfigNoun
-    self.register_noun(ConfigNoun())
-    from apache.aurora.client.cli.quota import Quota
-    self.register_noun(Quota())
-    from apache.aurora.client.cli.sla import Sla
-    self.register_noun(Sla())
-    from apache.aurora.client.cli.task import Task
-    self.register_noun(Task())
-
+# TODO(mchucarroll): the entire bridged executable mechanism here is
+# intended to be deprecated once clientv2 has proven to be stable
+# and adopted by most users. Once we reach that point, this should
+# be replaced by the standalone executable defined in standalone_client.py.
 
 class AuroraClientV2CommandProcessor(CommandProcessor):
   def __init__(self):

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/ca4adf93/src/main/python/apache/aurora/client/cli/standalone_client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/standalone_client.py b/src/main/python/apache/aurora/client/cli/standalone_client.py
new file mode 100644
index 0000000..1e63ead
--- /dev/null
+++ b/src/main/python/apache/aurora/client/cli/standalone_client.py
@@ -0,0 +1,53 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import sys
+
+from apache.aurora.client.cli import CommandLine
+from apache.aurora.client.cli.logsetup import setup_default_log_handlers
+import logging
+
+
+class AuroraCommandLine(CommandLine):
+  """The CommandLine implementation for the Aurora client v2 command line."""
+
+  @classmethod
+  def get_description(cls):
+    return 'Aurora client command line'
+
+  def register_nouns(self):
+    super(AuroraCommandLine, self).register_nouns()
+    from apache.aurora.client.cli.cron import CronNoun
+    self.register_noun(CronNoun())
+    from apache.aurora.client.cli.jobs import Job
+    self.register_noun(Job())
+    from apache.aurora.client.cli.config import ConfigNoun
+    self.register_noun(ConfigNoun())
+    from apache.aurora.client.cli.quota import Quota
+    self.register_noun(Quota())
+    from apache.aurora.client.cli.sla import Sla
+    self.register_noun(Sla())
+    from apache.aurora.client.cli.task import Task
+    self.register_noun(Task())
+
+
+def proxy_main():
+  client = AuroraCommandLine()
+  setup_default_log_handlers(logging.INFO)
+  if len(sys.argv) == 1:
+    sys.argv.append("help")
+  client.execute(sys.argv[1:])
+
+if __name__ == '__main__':
+  proxy_main()
+