Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import time,randint,config
  2.  
  3. users = 1000
  4. users_rate = 10
  5.  
  6. class UserBehavior(TaskSet):
  7.  
  8. wait_secs = config.wait_for_locusts_to_hatch(locusts_num=users, hatch_rate=users_rate)
  9.  
  10. def on_start(self):
  11. print "-----Start of locust run-----"
  12.  
  13. user_num = random.randint(602, 10000)
  14. username = "user_%s" % user_num
  15. password = "secret"
  16.  
  17. # required time to hatch the users
  18. config.load_sleep(self.wait_secs, self.wait_secs)
  19.  
  20. self.login_use(user_num, username, password)
  21.  
  22. print "-----End of locust run-----"
  23.  
  24. # This should be imported from a config file
  25. # def wait_for_locusts_to_hatch(locusts_num, hatch_rate):
  26. # wait_secs = (locusts_num / hatch_rate) + 10 # +10 to be safe
  27. # print "-- Waiting %s secs for locusts to hatch --" % wait_secs
  28.  
  29. # return wait_secs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement