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: Print out the job url after scheduling a cron job.
Date Mon, 10 Nov 2014 22:42:45 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 33cf4c811 -> 01958b1df


Print out the job url after scheduling a cron job.

Bugs closed: AURORA-857

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


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

Branch: refs/heads/master
Commit: 01958b1dfa4192549802ee39595cd050b27f5a69
Parents: 33cf4c8
Author: Zameer Manji <zmanji@twopensource.com>
Authored: Mon Nov 10 14:42:08 2014 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Nov 10 14:42:08 2014 -0800

----------------------------------------------------------------------
 src/main/python/apache/aurora/client/cli/cron.py      | 4 ++++
 src/test/python/apache/aurora/client/cli/test_cron.py | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/01958b1d/src/main/python/apache/aurora/client/cli/cron.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/cli/cron.py b/src/main/python/apache/aurora/client/cli/cron.py
index e0510df..44c066b 100644
--- a/src/main/python/apache/aurora/client/cli/cron.py
+++ b/src/main/python/apache/aurora/client/cli/cron.py
@@ -46,6 +46,10 @@ class Schedule(Verb):
     resp = api.schedule_cron(config)
     context.check_and_log_response(resp,
         err_msg=("Error scheduling cron job %s:" % context.options.jobspec))
+
+    context.print_out("Cron job scheduled, status can be viewed at %s"
+        % context.get_job_page(api, context.options.jobspec))
+
     return EXIT_OK
 
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/01958b1d/src/test/python/apache/aurora/client/cli/test_cron.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_cron.py b/src/test/python/apache/aurora/client/cli/test_cron.py
index 029a0c5..9c1f0be 100644
--- a/src/test/python/apache/aurora/client/cli/test_cron.py
+++ b/src/test/python/apache/aurora/client/cli/test_cron.py
@@ -21,6 +21,7 @@ from twitter.common.contextutil import temporary_file
 
 from apache.aurora.client.cli import EXIT_API_ERROR, EXIT_INVALID_CONFIGURATION, EXIT_OK
 from apache.aurora.client.cli.client import AuroraCommandLine
+from apache.aurora.common.aurora_job_key import AuroraJobKey
 from apache.aurora.config import AuroraConfig
 
 from ..api.api_util import SchedulerProxyApiSpec
@@ -33,6 +34,7 @@ class TestCronNoun(AuroraClientCommandTest):
 
   def test_successful_schedule(self):
     mock_context = FakeAuroraCommandContext()
+    key = AuroraJobKey("west", "bozo", "test", "hello")
     with contextlib.nested(
         patch('apache.aurora.client.cli.cron.CronNoun.create_context', return_value=mock_context)):
 
@@ -42,14 +44,16 @@ class TestCronNoun(AuroraClientCommandTest):
         fp.write(self.get_valid_config())
         fp.flush()
         cmd = AuroraCommandLine()
-        cmd.execute(['cron', 'schedule', 'west/bozo/test/hello',
-            fp.name])
+        cmd.execute(['cron', 'schedule', key.to_path(), fp.name])
 
       # Now check that the right API calls got made.
       # Check that create_job was called exactly once, with an AuroraConfig parameter.
       assert api.schedule_cron.call_count == 1
       assert isinstance(api.schedule_cron.call_args[0][0], AuroraConfig)
 
+      # The last text printed out to the user should contain a url to the job
+      assert mock_context.get_job_page(api, key) in mock_context.out[-1]
+
   def test_schedule_failed(self):
     mock_context = FakeAuroraCommandContext()
     with patch('apache.aurora.client.cli.cron.CronNoun.create_context', return_value=mock_context):


Mime
View raw message