ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject git commit: AMBARI-3561. Add initial_wait attribute (Andrew Onischuk via dlysnichenko)
Date Tue, 22 Oct 2013 16:22:30 GMT
Updated Branches:
  refs/heads/trunk 57a9dd04d -> 280c15507


AMBARI-3561. Add initial_wait attribute (Andrew Onischuk via dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 280c1550768fb6b1849e4de48a88d573d8794a18
Parents: 57a9dd0
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Tue Oct 22 19:20:44 2013 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Tue Oct 22 19:21:45 2013 +0300

----------------------------------------------------------------------
 ambari-agent/src/main/python/resource_management/base.py    | 9 +++++----
 .../src/main/python/resource_management/environment.py      | 4 ++++
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/280c1550/ambari-agent/src/main/python/resource_management/base.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/base.py b/ambari-agent/src/main/python/resource_management/base.py
index b95adee..5e3c391 100644
--- a/ambari-agent/src/main/python/resource_management/base.py
+++ b/ambari-agent/src/main/python/resource_management/base.py
@@ -79,10 +79,11 @@ class Resource(object):
 
   action = ForcedListArgument(default="nothing")
   ignore_failures = BooleanArgument(default=False)
-  notifies = ResourceArgument(default=[])
-  subscribes = ResourceArgument(default=[])
-  not_if = ResourceArgument()
-  only_if = ResourceArgument()
+  notifies = ResourceArgument(default=[]) # this is not supported/recommended
+  subscribes = ResourceArgument(default=[]) # this is not supported/recommended
+  not_if = ResourceArgument() # pass command e.g. not_if = ('ls','/root/jdk')
+  only_if = ResourceArgument() # pass command
+  initial_wait = ResourceArgument() # in seconds
 
   actions = ["nothing"]
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/280c1550/ambari-agent/src/main/python/resource_management/environment.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/environment.py b/ambari-agent/src/main/python/resource_management/environment.py
index 089a03a..30bb728 100644
--- a/ambari-agent/src/main/python/resource_management/environment.py
+++ b/ambari-agent/src/main/python/resource_management/environment.py
@@ -5,6 +5,7 @@ __all__ = ["Environment"]
 import logging
 import os
 import shutil
+import time
 from datetime import datetime
 
 from resource_management import shell
@@ -102,6 +103,9 @@ class Environment(object):
       # Run resource actions
       for resource in self.resource_list:
         self.log.debug("Running resource %r" % resource)
+        
+        if resource.initial_wait:
+          time.sleep(resource.initial_wait)
 
         if resource.not_if is not None and self._check_condition(
           resource.not_if):


Mime
View raw message