Repository: incubator-aurora
Updated Branches:
refs/heads/master bf044427c -> 81d5c5c81
Adding pause/resume/abort client APIs.
Bugs closed: AURORA-615
Reviewed at https://reviews.apache.org/r/25159/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/81d5c5c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/81d5c5c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/81d5c5c8
Branch: refs/heads/master
Commit: 81d5c5c81209052348e358ea43bd23b518007da3
Parents: bf04442
Author: Maxim Khutornenko <ma...@apache.org>
Authored: Thu Aug 28 11:54:49 2014 -0700
Committer: Maxim Khutornenko <ma...@apache.org>
Committed: Thu Aug 28 11:54:49 2014 -0700
----------------------------------------------------------------------
.../python/apache/aurora/client/api/__init__.py | 33 +++++++++++++++
.../python/apache/aurora/client/api/test_api.py | 42 ++++++++++++++++++++
2 files changed, 75 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/81d5c5c8/src/main/python/apache/aurora/client/api/__init__.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/__init__.py b/src/main/python/apache/aurora/client/api/__init__.py
index 4968738..90462bf 100644
--- a/src/main/python/apache/aurora/client/api/__init__.py
+++ b/src/main/python/apache/aurora/client/api/__init__.py
@@ -191,6 +191,39 @@ class AuroraClientAPI(object):
return self._scheduler_proxy.startJobUpdate(request)
+ def pause_job_update(self, job_key):
+ """Requests Scheduler to pause active job update.
+
+ Arguments:
+ job_key - Job key identifying the update to pause.
+
+ Returns response object.
+ """
+ self._assert_valid_job_key(job_key)
+ return self._scheduler_proxy.pauseJobUpdate(job_key.to_thrift())
+
+ def resume_job_update(self, job_key):
+ """Requests Scheduler to resume a job update paused previously.
+
+ Arguments:
+ job_key - Job key identifying the update to resume.
+
+ Returns response object.
+ """
+ self._assert_valid_job_key(job_key)
+ return self._scheduler_proxy.resumeJobUpdate(job_key.to_thrift())
+
+ def abort_job_update(self, job_key):
+ """Requests Scheduler to abort active or paused job update.
+
+ Arguments:
+ job_key - Job key identifying the update to abort.
+
+ Returns response object.
+ """
+ self._assert_valid_job_key(job_key)
+ return self._scheduler_proxy.abortJobUpdate(job_key.to_thrift())
+
def cancel_update(self, job_key):
"""Cancel the update represented by job_key. Returns whether or not the cancellation was
successful."""
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/81d5c5c8/src/test/python/apache/aurora/client/api/test_api.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_api.py b/src/test/python/apache/aurora/client/api/test_api.py
index 237d4ab..b47b6db 100644
--- a/src/test/python/apache/aurora/client/api/test_api.py
+++ b/src/test/python/apache/aurora/client/api/test_api.py
@@ -149,3 +149,45 @@ class TestJobUpdateApis(unittest.TestCase):
AuroraClientAPI.UpdateConfigError,
api.start_job_update,
self.mock_job_config(error=ValueError()))
+
+ def test_pause_job_update(self):
+ """Test successful job update pause."""
+ job_key = AuroraJobKey("foo", "role", "env", "name")
+ api, mock_proxy = self.mock_api()
+ mock_proxy.pauseJobUpdate.return_value = self.create_simple_success_response()
+
+ api.pause_job_update(job_key)
+ mock_proxy.pauseJobUpdate.assert_called_once_with(job_key.to_thrift())
+
+ def test_pause_job_update_invalid_key(self):
+ """Test job update pause with invalid job key."""
+ api, mock_proxy = self.mock_api()
+ self.assertRaises(AuroraClientAPI.TypeError, api.pause_job_update, "invalid")
+
+ def test_resume_job_update(self):
+ """Test successful job update resume."""
+ job_key = AuroraJobKey("foo", "role", "env", "name")
+ api, mock_proxy = self.mock_api()
+ mock_proxy.resumeJobUpdate.return_value = self.create_simple_success_response()
+
+ api.resume_job_update(job_key)
+ mock_proxy.resumeJobUpdate.assert_called_once_with(job_key.to_thrift())
+
+ def test_resume_job_update_invalid_key(self):
+ """Test job update resume with invalid job key."""
+ api, mock_proxy = self.mock_api()
+ self.assertRaises(AuroraClientAPI.TypeError, api.resume_job_update, "invalid")
+
+ def test_abort_job_update(self):
+ """Test successful job update abort."""
+ job_key = AuroraJobKey("foo", "role", "env", "name")
+ api, mock_proxy = self.mock_api()
+ mock_proxy.abortJobUpdate.return_value = self.create_simple_success_response()
+
+ api.abort_job_update(job_key)
+ mock_proxy.abortJobUpdate.assert_called_once_with(job_key.to_thrift())
+
+ def test_abort_job_update_invalid_key(self):
+ """Test job update abort with invalid job key."""
+ api, mock_proxy = self.mock_api()
+ self.assertRaises(AuroraClientAPI.TypeError, api.abort_job_update, "invalid")