]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix docstrings for task/blktrace.py, peering_speed_test.py, proc_thrasher.py and 197/head
authorWarren Usui <warren.usui@inktank.com>
Fri, 14 Feb 2014 23:13:01 +0000 (15:13 -0800)
committerWarren Usui <warren.usui@inktank.com>
Fri, 14 Feb 2014 23:13:01 +0000 (15:13 -0800)
recovery_bench.py.

Fixes: 6535
Signed-off-by: Warren Usui <warren.usui@inktank.com>
teuthology/task/blktrace.py
teuthology/task/peering_speed_test.py
teuthology/task/proc_thrasher.py
teuthology/task/recovery_bench.py

index bfe05f4235ca9a578aaf98b7ed7449cccbad199e..208bfd533cee43c2cf4bdade40dbc6fbbd25666a 100644 (file)
@@ -1,3 +1,6 @@
+"""
+Run blktrace program through teuthology
+"""
 import contextlib
 import logging
 
@@ -11,11 +14,14 @@ daemon_signal = 'term'
 
 @contextlib.contextmanager
 def setup(ctx, config):
+    """
+    Setup all the remotes
+    """
     osds = ctx.cluster.only(teuthology.is_type('osd'))
     log_dir = '{tdir}/archive/performance/blktrace'.format(tdir=teuthology.get_testdir(ctx))
 
     for remote, roles_for_host in osds.remotes.iteritems():
-        log.info('Creating %s on %s' % (log_dir,remote.name))
+        log.info('Creating %s on %s' % (log_dir, remote.name))
         remote.run(
             args=['mkdir', '-p', '-m0755', '--', log_dir],
             wait=False,
@@ -24,8 +30,11 @@ def setup(ctx, config):
 
 @contextlib.contextmanager
 def execute(ctx, config):
+    """
+    Run the blktrace program on remote machines.
+    """
     procs = []
-    testdir=teuthology.get_testdir(ctx)
+    testdir = teuthology.get_testdir(ctx)
     log_dir = '{tdir}/archive/performance/blktrace'.format(tdir=testdir)
 
     osds = ctx.cluster.only(teuthology.is_type('osd'))
@@ -64,6 +73,12 @@ def execute(ctx, config):
 
 @contextlib.contextmanager
 def task(ctx, config):
+    """
+    Usage:
+        blktrace:
+      
+    Runs blktrace on all clients.
+    """
     if config is None:
         config = dict(('client.{id}'.format(id=id_), None)
                   for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client'))
index d70b5a4225a903a3c8d0451af959680e35f4b86f..6c885f1c961b785dc84cd07f8db88605f8edcc1b 100644 (file)
@@ -1,3 +1,6 @@
+"""
+Remotely run peering tests.
+"""
 import logging
 import time
 from teuthology import misc as teuthology
@@ -19,6 +22,9 @@ ARGS = [
     ]
 
 def setup(ctx, config):
+    """
+    Setup peering test on remotes.
+    """
     first_mon = teuthology.get_first_mon(ctx, config)
     (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
     ctx.manager = ceph_manager.CephManager(
@@ -38,6 +44,9 @@ def setup(ctx, config):
     log.info("done populating pool")
 
 def do_run(ctx, config):
+    """
+    Perform the test.
+    """
     start = time.time()
     # mark in osd
     ctx.manager.mark_in_osd(0)
index 472b6ecbdc8ffe8c2791729efd9cf8aec84ed2ed..1c1100fc561cc12d695a0f02e582a1b5cd0e076d 100644 (file)
@@ -1,3 +1,6 @@
+"""
+Process thrasher
+"""
 import logging
 import gevent
 import random
@@ -25,18 +28,32 @@ class ProcThrasher:
         self.run_time = self.config.get("run_time", 1000) # seconds
 
     def log(self, msg):
+        """
+        Local log wrapper
+        """
         self.logger.info(msg)
 
     def start(self):
+        """
+        Start thrasher.  This also makes sure that the greenlet interface
+        is used.
+        """
         if self.greenlet is not None:
             return
         self.greenlet = gevent.Greenlet(self.loop)
         self.greenlet.start()
 
     def join(self):
+        """
+        Local join
+        """
         self.greenlet.join()
 
     def loop(self):
+        """
+        Thrashing loop -- loops at time intervals.  Inside that loop, the
+        code loops through the individual procs, creating new procs.
+        """
         time_started = time.time()
         procs = []
         self.log("Starting")
index 569bba84ca6594f7156cd4d8afbb55cfbc446575..1984b97d31effc699846f2e2f44fa2bc7d6a306e 100644 (file)
@@ -1,3 +1,6 @@
+"""
+Recovery system benchmarking
+"""
 from cStringIO import StringIO
 
 import contextlib
@@ -68,6 +71,9 @@ def task(ctx, config):
         bench_proc.do_join()
 
 class RecoveryBencher:
+    """
+    RecoveryBencher
+    """
     def __init__(self, manager, config):
         self.ceph_manager = manager
         self.ceph_manager.wait_for_clean()
@@ -81,6 +87,9 @@ class RecoveryBencher:
 
         else:
             def tmp(x):
+                """
+                Local wrapper to print value.
+                """
                 print x
             self.log = tmp
 
@@ -89,9 +98,16 @@ class RecoveryBencher:
         self.thread = gevent.spawn(self.do_bench)
 
     def do_join(self):
+        """
+        Join the recovery bencher.  This is called after the main
+        task exits.
+        """
         self.thread.get()
 
     def do_bench(self):
+        """
+        Do the benchmarking.
+        """
         duration = self.config.get("duration", 60)
         num_objects = self.config.get("num_objects", 500)
         io_size = self.config.get("io_size", 4096)
@@ -160,6 +176,11 @@ class RecoveryBencher:
         self.ceph_manager.raw_cluster_cmd('osd', 'in', osd)
 
     def process_samples(self, input):
+        """
+        Extract samples from the input and process the results
+
+        :param input: input lines in JSON format
+        """
         lat = {}
         for line in input.split('\n'):
             try:
@@ -167,7 +188,7 @@ class RecoveryBencher:
                 samples = lat.setdefault(sample['type'], [])
                 samples.append(float(sample['latency']))
             except Exception:
-              pass
+                pass
 
         for type in lat:
             samples = lat[type]