Say "worker_id" instead of name, as I keep confusing it with filenames.

This commit is contained in:
Tommi Virtanen 2011-07-20 11:15:06 -07:00
parent 1eb38e09e4
commit f3b5ed6ccc

View file

@ -16,7 +16,7 @@ import common
NANOSECOND = int(1e9) NANOSECOND = int(1e9)
def reader(bucket, name, queue): def reader(bucket, worker_id, queue):
while True: while True:
count = 0 count = 0
for key in bucket.list(): for key in bucket.list():
@ -34,14 +34,14 @@ def reader(bucket, name, queue):
start=start, start=start,
duration=int(round(elapsed * NANOSECOND)), duration=int(round(elapsed * NANOSECOND)),
#TODO error, fp.valid() #TODO error, fp.valid()
#TODO name worker=worker_id,
), ),
) )
count += 1 count += 1
if count == 0: if count == 0:
gevent.sleep(1) gevent.sleep(1)
def writer(bucket, name, queue, file_size=1, file_stddev=0, file_name_seed=None): def writer(bucket, worker_id, queue, file_size=1, file_stddev=0, file_name_seed=None):
r = random.randint(0, 65535) r = random.randint(0, 65535)
r2 = r r2 = r
if file_name_seed != None: if file_name_seed != None:
@ -78,6 +78,7 @@ def writer(bucket, name, queue, file_size=1, file_stddev=0, file_name_seed=None)
start=start, start=start,
duration=int(round(elapsed * NANOSECOND)), duration=int(round(elapsed * NANOSECOND)),
#TODO error #TODO error
worker=worker_id,
), ),
) )
@ -122,7 +123,7 @@ def main():
group.spawn_link_exception( group.spawn_link_exception(
writer, writer,
bucket=bucket, bucket=bucket,
name=x, worker_id=x,
queue=q, queue=q,
file_size=options.file_size, file_size=options.file_size,
file_stddev=options.stddev, file_stddev=options.stddev,
@ -132,7 +133,7 @@ def main():
group.spawn_link_exception( group.spawn_link_exception(
reader, reader,
bucket=bucket, bucket=bucket,
name=x, worker_id=x,
queue=q, queue=q,
) )
def stop(): def stop():