Guest User

Untitled

a guest
Nov 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. redIs = redis.Redis()
  2. pipe = redIs.pipeline()
  3. n = 1
  4. for line in open(path_to_file, 'r', encoding='utf-8'):
  5. pipe.sadd('todo', line.rstrip())
  6. n = n + 1
  7. if (n % 64) == 0:
  8. pipe.execute()
  9. pipe = redIs.pipeline()
  10.  
  11. def restart_redis_instance(name="redis_test"):
  12. share_path = ('/E/test')
  13. volumes = {share_path: {'bind': '/data', 'mode': ''}}
  14.  
  15. client = docker.from_env()
  16. try:
  17. kont = client.containers.get(name)
  18. kont.remove(force=True)
  19. except:
  20. pass
  21. client.containers.run(name=name,
  22. image="redis",
  23. ports={6379: 6379},
  24. detach=True,
  25. mem_limit='8g',
  26. volumes=volumes)
Add Comment
Please, Sign In to add comment