Author: brandonwilliams Date: Fri Dec 17 18:03:10 2010 New Revision: 1050461
URL: http://svn.apache.org/viewvc?rev=1050461&view=rev Log: Allow passing a file containing nodes to stress.py. Patch by Matthew Dennis, review by brandonwilliams for CASSANDRA-1874. Modified: cassandra/branches/cassandra-0.7/contrib/py_stress/stress.py Modified: cassandra/branches/cassandra-0.7/contrib/py_stress/stress.py URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/contrib/py_stress/stress.py?rev=1050461&r1=1050460&r2=1050461&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/contrib/py_stress/stress.py (original) +++ cassandra/branches/cassandra-0.7/contrib/py_stress/stress.py Fri Dec 17 18:03:10 2010 @@ -18,6 +18,8 @@ # expects a Cassandra server to be running and listening on port 9160. # (read tests expect insert tests to have run first too.) +from __future__ import with_statement + have_multiproc = False try: from multiprocessing import Array as array, Process as Thread @@ -73,6 +75,8 @@ parser.add_option('-C', '--cardinality', help="Number of unique values stored in columns", default=50) parser.add_option('-d', '--nodes', type="string", dest="nodes", help="Host nodes (comma separated)", default="localhost") +parser.add_option('-D', '--nodefile', type="string", dest="nodefile", + help="File containing list of nodes (one per line)", default=None) parser.add_option('-s', '--stdev', type="float", dest="stdev", default=0.1, help="standard deviation factor") parser.add_option('-r', '--random', action="store_true", dest="random", @@ -118,6 +122,9 @@ supers_per_key = options.supers # this allows client to round robin requests directly for # simple request load-balancing nodes = options.nodes.split(',') +if options.nodefile != None: + with open(options.nodefile) as f: + nodes = [n.strip() for n in f.readlines() if len(n.strip()) > 0] # a generator that generates all keys according to a bell curve centered # around the middle of the keys generated (0..total_keys). Remember that
