You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/03/01 23:39:13 UTC

svn commit: r1451749 - in /incubator/ambari/trunk: ./ ambari-agent/ ambari-agent/conf/unix/ ambari-agent/src/main/python/ambari_agent/ ambari-web/app/styles/

Author: yusaku
Date: Fri Mar  1 22:39:13 2013
New Revision: 1451749

URL: http://svn.apache.org/r1451749
Log:
Reverting commit for AMBARI-1537. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/conf/unix/ambari-agent.ini
    incubator/ambari/trunk/ambari-agent/pom.xml
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/Grep.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/NetUtil.py
    incubator/ambari/trunk/ambari-web/app/styles/application.less

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Mar  1 22:39:13 2013
@@ -77,8 +77,6 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
- AMBARI-1537. Constrain the width of all wizard popups. (Xi Wang via yusaku)
-
  AMBARI-1536. Hosts page layout fixes. (Xi Wang via yusaku)
 
  AMBARI-1502. Add the ability to assign configuration to a cluster. (Nate Cole via tbeerbower)

Modified: incubator/ambari/trunk/ambari-agent/conf/unix/ambari-agent.ini
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/conf/unix/ambari-agent.ini?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/conf/unix/ambari-agent.ini (original)
+++ incubator/ambari/trunk/ambari-agent/conf/unix/ambari-agent.ini Fri Mar  1 22:39:13 2013
@@ -22,7 +22,6 @@ prefix=/var/lib/ambari-agent/data
 
 [stack]
 installprefix=/var/ambari-agent/
-upgradeScriptsDir=/var/lib/ambari-agent/upgrade_stack
 
 [puppet]
 puppetmodules=/var/lib/ambari-agent/puppet

Modified: incubator/ambari/trunk/ambari-agent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/pom.xml?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/pom.xml (original)
+++ incubator/ambari/trunk/ambari-agent/pom.xml Fri Mar  1 22:39:13 2013
@@ -204,17 +204,6 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>/var/lib/${project.artifactId}/upgrade_scripts</directory>
-              <filemode>755</filemode>
-              <username>root</username>
-              <groupname>root</groupname>
-              <sources>
-                <source>
-                  <location>src/main/upgrade_scripts</location>
-                </source>
-              </sources>
-            </mapping>
-            <mapping>
               <directory>${package.conf.dir}</directory>
               <configuration>true</configuration>
               <filemode>755</filemode>

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py Fri Mar  1 22:39:13 2013
@@ -33,9 +33,7 @@ import os
 import time
 import subprocess
 import copy
-import PuppetExecutor
-import UpgradeExecutor
-import PythonExecutor
+import puppetExecutor
 import tempfile
 from Grep import Grep
 
@@ -45,31 +43,26 @@ installScriptHash = -1
 class ActionQueue(threading.Thread):
   """ Action Queue for the agent. We pick one command at a time from the queue
   and execute that """
-  
+  global commandQueue, resultQueue #, STATUS_COMMAND, EXECUTION_COMMAND
   commandQueue = Queue.Queue()
   resultQueue = Queue.Queue()
 
   STATUS_COMMAND='STATUS_COMMAND'
   EXECUTION_COMMAND='EXECUTION_COMMAND'
-  UPGRADE_STATUS='UPGRADE'
-
   IDLE_SLEEP_TIME = 5
 
   def __init__(self, config):
     super(ActionQueue, self).__init__()
+    #threading.Thread.__init__(self)
     self.config = config
     self.sh = shellRunner()
     self._stop = threading.Event()
     self.maxRetries = config.getint('command', 'maxretries') 
     self.sleepInterval = config.getint('command', 'sleepBetweenRetries')
-    self.puppetExecutor = PuppetExecutor.PuppetExecutor(
-                                   config.get('puppet', 'puppetmodules'),
+    self.executor = puppetExecutor.puppetExecutor(config.get('puppet', 'puppetmodules'),
                                    config.get('puppet', 'puppet_home'),
                                    config.get('puppet', 'facter_home'),
                                    config.get('agent', 'prefix'), config)
-    self.pythonExecutor = PythonExecutor.PythonExecutor()
-    self.upgradeExecutor = UpgradeExecutor.UpgradeExecutor(self.pythonExecutor,
-                                   PuppetExecutor, config)
     self.tmpdir = config.get('agent', 'prefix')
     self.commandInProgress = None
 
@@ -79,16 +72,24 @@ class ActionQueue(threading.Thread):
   def stopped(self):
     return self._stop.isSet()
 
+  def getshellinstance(self):
+    """ For Testing purpose only.""" 
+    return self.sh
+
   def put(self, command):
     logger.info("The " + command['commandType'] + " from the server is \n" + pprint.pformat(command))
-    self.commandQueue.put(command)
+    commandQueue.put(command)
     pass
 
+  def getCommandQueue(self):
+    """ For Testing purpose only."""
+    return commandQueue
+
   def run(self):
     result = []
     while not self.stopped():
-      while not self.commandQueue.empty():
-        command = self.commandQueue.get()
+      while not commandQueue.empty():
+        command = commandQueue.get()
         logger.info("Took an element of Queue: " + pprint.pformat(command))
         if command['commandType'] == self.EXECUTION_COMMAND:
           try:
@@ -102,8 +103,8 @@ class ActionQueue(threading.Thread):
             pass
 
           for entry in result:
-            self.resultQueue.put((command['commandType'], entry))
-
+            resultQueue.put((ActionQueue.EXECUTION_COMMAND, entry))
+          pass
         elif command['commandType'] == self.STATUS_COMMAND:
           cluster = command['clusterName']
           service = command['serviceName']
@@ -115,7 +116,7 @@ class ActionQueue(threading.Thread):
             logger.info("Got live status for component " + component + " of service " + str(service) +\
                         " of cluster " + str(cluster) + "\n" + pprint.pformat(result))
             if result is not None:
-              self.resultQueue.put((ActionQueue.STATUS_COMMAND, result))
+              resultQueue.put((ActionQueue.STATUS_COMMAND, result))
           except Exception, err:
             traceback.print_exc()
             logger.warn(err)
@@ -129,9 +130,9 @@ class ActionQueue(threading.Thread):
   def result(self):
     resultReports = []
     resultComponentStatus = []
-    while not self.resultQueue.empty():
-      res = self.resultQueue.get()
-      if res[0] == self.EXECUTION_COMMAND:
+    while not resultQueue.empty():
+      res = resultQueue.get()
+      if res[0] == ActionQueue.EXECUTION_COMMAND:
         resultReports.append(res[1])
       elif res[0] == ActionQueue.STATUS_COMMAND:
         resultComponentStatus.append(res[1])
@@ -146,7 +147,7 @@ class ActionQueue(threading.Thread):
         tmpout='...'
         tmperr='...'
       grep = Grep()
-      output = grep.tail(tmpout, Grep.OUTPUT_LAST_LINES)
+      output = grep.tail(tmpout, puppetExecutor.puppetExecutor.OUTPUT_LAST_LINES)
       inprogress = {
         'role' : self.commandInProgress['role'],
         'actionId' : self.commandInProgress['actionId'],
@@ -165,6 +166,12 @@ class ActionQueue(threading.Thread):
     }
     return result
 
+  def registerCommand(self, command):
+    return {}
+  
+  def statusCommand(self, command):
+    return {}
+  
   def executeCommand(self, command):
     logger.info("Executing command \n" + pprint.pformat(command))
     clusterName = command['clusterName']
@@ -189,11 +196,7 @@ class ActionQueue(threading.Thread):
       'tmperr': self.tmpdir + os.sep + 'errors-' + str(taskId) + '.txt'
     }
     # running command
-    if command['commandType'] == ActionQueue.EXECUTION_COMMAND:
-      if command['roleCommand'] == ActionQueue.UPGRADE_STATUS:
-        commandresult = self.upgradeExecutor.perform_stack_upgrade(command, self.commandInProgress['tmpout'], self.commandInProgress['tmperr'])
-      else:
-        commandresult = self.puppetExecutor.runCommand(command, self.commandInProgress['tmpout'], self.commandInProgress['tmperr'])
+    commandresult = self.executor.runCommand(command, self.commandInProgress['tmpout'], self.commandInProgress['tmperr'])
     # dumping results
     self.commandInProgress = None
     status = "COMPLETED"
@@ -215,8 +218,17 @@ class ActionQueue(threading.Thread):
     if roleResult['stderr'] == '':
       roleResult['stderr'] = 'None'
     result.append(roleResult)
+    pass
     return result
 
+  def noOpCommand(self, command):
+    result = {'commandId' : command['Id']}
+    return result
+
+  def unknownAction(self, action):
+    logger.error('Unknown action: %s' % action['id'])
+    result = { 'id': action['id'] }
+    return result
 
   def isIdle(self):
-    return self.commandQueue.empty()
+    return commandQueue.empty()

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py Fri Mar  1 22:39:13 2013
@@ -38,7 +38,6 @@ prefix=/tmp/ambari-agent
 
 [stack]
 installprefix=/tmp
-upgradeScriptsDir=/var/lib/ambari-agent/upgrade_stack
 
 [puppet]
 puppetmodules=/var/lib/ambari-agent/puppet/

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/Grep.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/Grep.py?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/Grep.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/Grep.py Fri Mar  1 22:39:13 2013
@@ -17,13 +17,6 @@ import re
 
 class Grep:
 
-  # How many lines from command output send to server
-  OUTPUT_LAST_LINES = 10
-  # How many lines from command error output send to server (before Err phrase)
-  ERROR_LAST_LINES_BEFORE = 30
-  # How many lines from command error output send to server (after Err phrase)
-  ERROR_LAST_LINES_AFTER = 30
-
   def __init__(self):
     pass
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/NetUtil.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/NetUtil.py?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/NetUtil.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/NetUtil.py Fri Mar  1 22:39:13 2013
@@ -29,6 +29,7 @@ class NetUtil:
   CONNECT_SERVER_RETRY_INTERVAL_SEC = 10
   HEARTBEAT_IDDLE_INTERVAL_SEC = 10
   HEARTBEAT_NOT_IDDLE_INTERVAL_SEC = 5
+  HEARTBEAT_STATE_INTERVAL = 6 # default one per minute
 
   # Url within server to request during status check. This url
   # should return HTTP code 200

Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1451749&r1=1451748&r2=1451749&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Fri Mar  1 22:39:13 2013
@@ -645,7 +645,8 @@ a:focus {
 /*90% width modal window start*/
 .full-width-modal {
   .modal {
-
+    width: 90%;
+    margin: -350px 0 0 -45%;
   }
 
   .clear {
@@ -675,7 +676,6 @@ a:focus {
 
 /*60% width modal window start*/
 .sixty-percent-width-modal {
-
   .modal {
     width: 60%;
     margin: 0 0 0 -30%;
@@ -2603,14 +2603,6 @@ ul.inline li {
       width: 120px;
     }
   }
-
-  // when the scree is narrow, the popup modal width is adjustable
-  .full-width-modal {
-    .modal{
-      width: 90%;
-      margin: 350px 0 0 -45%;
-    }
-  }
 }
 
 //
@@ -2680,15 +2672,6 @@ i.icon-asterisks {
 
 //styles for screen width more than 1200px
 @media (min-width: 1200px) {
-
-  //when screen is wide, the modal width is fixed
-  .full-width-modal {
-    .modal{
-      width: 1170px;
-      margin: -350px 0 0 -583px;
-    }
-  }
-
   .row {
     margin-left: -30px;
     *zoom: 1;