aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mchucarr...@apache.org
Subject git commit: Add deprecation warnings to other clientv1 commands.
Date Tue, 05 Aug 2014 14:51:11 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master cccbac85a -> 495e35576


Add deprecation warnings to other clientv1 commands.

Testing Done:
[sun-wukong incubator-aurora (deprecation2)]$ ./dist/aurora2.pex ssh example/mchucarroll/test/foo
2 ls
WARNING: ssh is an aurora clientv1 command which will be deprecated soon
To run this command using clientv2, use 'aurora task ssh example/mchucarroll/test/foo/2 --command="ls"'

[sun-wukong incubator-aurora (deprecation2)]$ ./dist/aurora2.pex run example/mchucarroll/test/foo
 ls -la
WARNING: ssh is an aurora clientv1 command which will be deprecated soon
To run this command using clientv2, use 'aurora task run "ls -la"'

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


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

Branch: refs/heads/master
Commit: 495e35576995d05d3f1e5d03f5b2005a0cef8bac
Parents: cccbac8
Author: Mark Chu-Carroll <mchucarroll@twopensource.com>
Authored: Tue Aug 5 10:48:52 2014 -0400
Committer: Mark Chu-Carroll <mchucarroll@twitter.com>
Committed: Tue Aug 5 10:48:52 2014 -0400

----------------------------------------------------------------------
 .../python/apache/aurora/client/commands/run.py | 19 ++++++++++++++++++
 .../python/apache/aurora/client/commands/ssh.py | 21 ++++++++++++++++++++
 2 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/495e3557/src/main/python/apache/aurora/client/commands/run.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/commands/run.py b/src/main/python/apache/aurora/client/commands/run.py
index 169327f..7ed22d3 100644
--- a/src/main/python/apache/aurora/client/commands/run.py
+++ b/src/main/python/apache/aurora/client/commands/run.py
@@ -21,6 +21,14 @@ from apache.aurora.common.aurora_job_key import AuroraJobKey
 from apache.aurora.common.clusters import CLUSTERS
 
 
+# duplicate of same function in core.py; since this is a temporary deprecation warning,
+# we don't want to add new source files or inter-source dependencies. Duplicating this
+# two-line function is the lesser evil.
+def v1_deprecation_warning(old, new):
+  print("WARNING: %s is an aurora clientv1 command which will be deprecated soon" % old)
+  print("To run this command using clientv2, use 'aurora %s'" % " ".join(new))
+
+
 @app.command
 @app.command_option('-t', '--threads', type=int, default=1, dest='num_threads',
     help='The number of threads to use.')
@@ -41,6 +49,17 @@ def run(args, options):
   if not args:
     die('job path is required')
   job_path = args.pop(0)
+  new_cmd = ["task", "run" ]
+  instances_spec = job_path
+  if options.num_threads != 1:
+    new_cmd.append("--threads=%s" % options.num_threads)
+  if options.ssh_user is not None:
+    new_cmd.append("--ssh-user=%s" % options.ssh_user)
+  if options.executor_sandbox:
+    new_cmd.append("--executor-sandbox")
+  new_cmd.append("\"%s\"" % " ".join(args))
+  v1_deprecation_warning("ssh", new_cmd)
+
   try:
     cluster_name, role, env, name = AuroraJobKey.from_path(job_path)
   except AuroraJobKey.Error as e:

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/495e3557/src/main/python/apache/aurora/client/commands/ssh.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/commands/ssh.py b/src/main/python/apache/aurora/client/commands/ssh.py
index 3823338..37a9008 100644
--- a/src/main/python/apache/aurora/client/commands/ssh.py
+++ b/src/main/python/apache/aurora/client/commands/ssh.py
@@ -23,6 +23,14 @@ from apache.aurora.client.options import EXECUTOR_SANDBOX_OPTION, SSH_USER_OPTIO
 from apache.aurora.common.aurora_job_key import AuroraJobKey
 
 
+# duplicate of same function in core.py; since this is a temporary deprecation warning,
+# we don't want to add new source files or inter-source dependencies. Duplicating this
+# two-line function is the lesser evil.
+def v1_deprecation_warning(old, new):
+  print("WARNING: %s is an aurora clientv1 command which will be deprecated soon" % old)
+  print("To run this command using clientv2, use 'aurora %s'" % " ".join(new))
+
+
 @app.command
 @app.command_option(EXECUTOR_SANDBOX_OPTION)
 @app.command_option(SSH_USER_OPTION)
@@ -47,6 +55,18 @@ def ssh(args, options):
     shard = int(args.pop(0))
   except ValueError:
     die('Shard must be an integer')
+
+  newcmd = ["task", "ssh", "%s/%s" % (job_path, shard)]
+  if len(options.tunnels) > 0:
+    newcmd.append("--tunnels=%s" % options.tunnels)
+  if options.ssh_user is not None:
+    newcmd.append("--ssh-user=%s" % options.ssh_user)
+  if options.executor_sandbox:
+    newcmd.append("--executor-sandbox")
+  if len(args) > 0:
+    newcmd.append("--command=\"%s\"" % " ".join(args))
+  v1_deprecation_warning("ssh", newcmd)
+
   api = make_client(cluster_name)
   resp = api.query(api.build_query(role, name, set([int(shard)]), env=env))
   check_and_log_response(resp)
@@ -58,6 +78,7 @@ def ssh(args, options):
 
   ssh_command = ['ssh', '-t']
 
+
   role = first_task.assignedTask.task.owner.role
   slave_host = first_task.assignedTask.slaveHost
 


Mime
View raw message