Project

General

Profile

Bug #5901 » multi.py

Test script to demonstrate issue - Brett Smith, 05/04/2015 08:25 PM

 
#!/usr/bin/env python

import arvados
import sys
import threading
import time

COLL_UUID = 'su92l-4zz18-wd2va9q9lnfx6ga'
NUM_RETRIES = 3

class CollectionTimer(threading.Thread):
def run(self):
arv = arvados.api('v1')
start_time = time.time()
coll = arv.collections().get(uuid=COLL_UUID).execute(num_retries=NUM_RETRIES)
print "thread {} got {}-byte manifest in {:.3f} seconds".format(
self.ident, len(coll['manifest_text']), time.time() - start_time)


threads = []
for tnum in range(int(sys.argv[1])):
t = CollectionTimer()
threads.append(t)
t.start()
print "started thread {}".format(t.ident)
for t in threads:
t.join()
(2-2/3)