10K_children.py 513 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python
  2. import arrow
  3. import requests
  4. # Generate 10,000 children of root node.
  5. requests.put('http://localhost:8000/ldp/pomegranate')
  6. start = arrow.utcnow()
  7. ckpt = start
  8. for i in range(1, 10000):
  9. requests.post('http://localhost:8000/ldp/pomegranate')
  10. if i % 100 == 0:
  11. now = arrow.utcnow()
  12. tdelta = now - ckpt
  13. ckpt = now
  14. print('Record: {}\tTime elapsed: {}'.format(i, tdelta))
  15. tdelta = arrow.utcnow() - start
  16. print('Total elapsed time: {}'.format(tdelta))