Browse Source

[2136] Updated the do_polling method

A list of instances for stats to request is obtained from the show_processes
command of Boss instead of asking the components config of Boss.
Naoki Kambe 12 years ago
parent
commit
6efc1e2e63
2 changed files with 10 additions and 11 deletions
  1. 8 9
      src/bin/stats/stats.py.in
  2. 2 2
      src/bin/stats/tests/test_utils.py

+ 8 - 9
src/bin/stats/stats.py.in

@@ -179,20 +179,19 @@ class Stats:
            each module to invoke 'getstats'. Finally updates internal
            each module to invoke 'getstats'. Finally updates internal
            statistics data every time it gets from each instance."""
            statistics data every time it gets from each instance."""
 
 
-        # count the number of instances of same module by examing
-        # 'components' of Boss via ConfigManager
+        # It counts the number of instances of same module by
+        # examining the third value from the array result of
+        # 'show_processes' of Boss
         seq = self.cc_session.group_sendmsg(
         seq = self.cc_session.group_sendmsg(
-            isc.config.ccsession.create_command(
-                isc.config.ccsession.COMMAND_GET_CONFIG,
-                {"module_name": "Boss"}), 'ConfigManager')
+            isc.config.ccsession.create_command("show_processes"),
+            'Boss')
         (answer, env) = self.cc_session.group_recvmsg(False, seq)
         (answer, env) = self.cc_session.group_recvmsg(False, seq)
         modules = []
         modules = []
         if answer:
         if answer:
             (rcode, value) = isc.config.ccsession.parse_answer(answer)
             (rcode, value) = isc.config.ccsession.parse_answer(answer)
-            if rcode == 0 and 'components' in value:
-                modules = [ c['special'].capitalize() \
-                                for c in value['components'].values() \
-                                if 'special' in c ]
+            if rcode == 0 and type(value) is list:
+                modules = [ v[2] if type(v) is list and len(v) > 2 \
+                                else None for v in value ]
         # start requesting each module to collect statistics data
         # start requesting each module to collect statistics data
         sequences = []
         sequences = []
         for (module_name, data) in self.get_statistics_data().items():
         for (module_name, data) in self.get_statistics_data().items():

+ 2 - 2
src/bin/stats/tests/test_utils.py

@@ -245,8 +245,8 @@ class MockBoss:
         self.spec_file.close()
         self.spec_file.close()
         self.cc_session = self.mccs._session
         self.cc_session = self.mccs._session
         self.got_command_name = ''
         self.got_command_name = ''
-        self.pid_list = [[ 9999, "b10-auth"   ],
-                         [ 9998, "b10-auth-2" ]]
+        self.pid_list = [[ 9999, "b10-auth", "Auth" ],
+                         [ 9998, "b10-auth-2", "Auth" ]]
         self.statistics_data = {
         self.statistics_data = {
             'boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', self._BASETIME)
             'boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', self._BASETIME)
             }
             }