aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zma...@apache.org
Subject incubator-aurora git commit: Adding command hook for beta-update start.
Date Wed, 04 Feb 2015 19:27:37 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 8bcb2baae -> b49e1a099


Adding command hook for beta-update start.

Also contains an update for the hooks documentation.

Testing Done:
./pants goal test src/test/python/apache/aurora/client/hooks:hooked_api

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


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

Branch: refs/heads/master
Commit: b49e1a099c6d385f1d57307ffed11427cfbccfa0
Parents: 8bcb2ba
Author: George Sirois <george.sirois@gmail.com>
Authored: Wed Feb 4 11:27:27 2015 -0800
Committer: Zameer Manji <zmanji@apache.org>
Committed: Wed Feb 4 11:27:27 2015 -0800

----------------------------------------------------------------------
 docs/hooks.md                                         | 14 ++++++++------
 .../python/apache/aurora/client/hooks/hooked_api.py   |  5 +++++
 .../apache/aurora/client/hooks/test_hooked_api.py     |  3 ++-
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b49e1a09/docs/hooks.md
----------------------------------------------------------------------
diff --git a/docs/hooks.md b/docs/hooks.md
index 533c81d..65e581d 100644
--- a/docs/hooks.md
+++ b/docs/hooks.md
@@ -86,11 +86,13 @@ You can associate `pre_`, `post_`, and `err_` hooks with the following
methods.
 
   Aurora Client API Method | Client API Method Argument Signature | Aurora Command Line Command
   -------------------------| ------------------------------------- | ---------------------------
-  ```cancel_update``` | ```self```, ```job_key``` | ```cancel_update```
-  ```create_job``` | ```self```, ```config``` | ```create```, <code>runtask
-  ```restart``` | ```self```, ```job_key```, ```shards```, ```update_config```, ```health_check_interval_seconds```
| ```restart```
-  ```update_job``` | ```self```, ```config```, ```health_check_interval_seconds=3```, ```shards=None```
| ```update```
-  ```kill_job``` | ```self```, ```job_key```, ```shards=None``` |  ```kill```
+  ```cancel_update``` | ```self```, ```job_key``` | ```job cancel-update```
+  ```create_job``` | ```self```, ```config``` | ```job create```, <code>runtask
+  ```restart``` | ```self```, ```job_key```, ```shards```, ```update_config```, ```health_check_interval_seconds```
| ```job restart```
+  ```update_job``` | ```self```, ```config```, ```health_check_interval_seconds=3```, ```shards=None```
| ```job update```
+  ```kill_job``` | ```self```, ```job_key```, ```shards=None``` |  ```job kill```
+  ```start_cronjob``` | ```self```, ```job_key``` | ```cron start```
+  ```start_job_update``` | ```self```, ```config```, ```instances=None``` | ```beta-update
start```
 
 Some specific examples:
 
@@ -189,7 +191,7 @@ If this method returns False, the API command call aborts.
 
 ## Generic Hooks
 
-There are five Aurora API Methods which any of the three hook types can attach to. Thus,
there are 15 possible hook/method combinations for a single `.aurora` config file. Say that
you define `pre_` and `post_` hooks for the `restart` method. That leaves 13 undefined hook/method
combinations; `err_restart` and the 3 `pre_`, `post_`, and `err_` hooks for each of the other
4 hookable methods. You can define what happens when any of these otherwise undefined 13 hooks
execute via a generic hook, whose signature is:
+There are seven Aurora API Methods which any of the three hook types can attach to. Thus,
there are 21 possible hook/method combinations for a single `.aurora` config file. Say that
you define `pre_` and `post_` hooks for the `restart` method. That leaves 19 undefined hook/method
combinations; `err_restart` and the 3 `pre_`, `post_`, and `err_` hooks for each of the other
6 hookable methods. You can define what happens when any of these otherwise undefined 19 hooks
execute via a generic hook, whose signature is:
 
 ```python
 generic_hook(self, hook_config, event, method_name, result_or_err, args*, kw**)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b49e1a09/src/main/python/apache/aurora/client/hooks/hooked_api.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/hooks/hooked_api.py b/src/main/python/apache/aurora/client/hooks/hooked_api.py
index bc61e91..60a5aad 100644
--- a/src/main/python/apache/aurora/client/hooks/hooked_api.py
+++ b/src/main/python/apache/aurora/client/hooks/hooked_api.py
@@ -183,3 +183,8 @@ class HookedAuroraClientAPI(NonHookedAuroraClientAPI):
         _partial(super(HookedAuroraClientAPI, self).update_job,
             config, health_check_interval_seconds=health_check_interval_seconds,
             instances=instances))
+
+  def start_job_update(self, config, instances=None):
+    return self._hooked_call(config, None,
+        _partial(super(HookedAuroraClientAPI, self).start_job_update,
+            config, instances=instances))

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b49e1a09/src/test/python/apache/aurora/client/hooks/test_hooked_api.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/hooks/test_hooked_api.py b/src/test/python/apache/aurora/client/hooks/test_hooked_api.py
index a1f474e..f92e715 100644
--- a/src/test/python/apache/aurora/client/hooks/test_hooked_api.py
+++ b/src/test/python/apache/aurora/client/hooks/test_hooked_api.py
@@ -20,7 +20,8 @@ from apache.aurora.client.api import AuroraClientAPI
 from apache.aurora.client.hooks.hooked_api import HookedAuroraClientAPI, NonHookedAuroraClientAPI
 from apache.aurora.common.cluster import Cluster
 
-API_METHODS = ('cancel_update', 'create_job', 'kill_job', 'restart', 'start_cronjob', 'update_job')
+API_METHODS = ('cancel_update', 'create_job', 'kill_job', 'restart', 'start_cronjob', 'update_job',
+               'start_job_update')
 API_METHODS_WITH_CONFIG_PARAM_ADDED = ('cancel_update', 'kill_job', 'restart', 'start_cronjob')
 
 


Mime
View raw message