Skip to content

Instantly share code, notes, and snippets.

@marram
Created December 22, 2011 21:26
Show Gist options
  • Save marram/1511931 to your computer and use it in GitHub Desktop.
Save marram/1511931 to your computer and use it in GitHub Desktop.
Fetching picks in parallel
def fetch_picks(games, users):
""" Fetches picks for a given list of games and users
"""
key_names = []
for user in users:
key_names.extend([Pick.make_key_name(user, game) for game in games])
# Fetch in parallel, 1k at a time
picks = []
for slice in miscutils.split_list(key_names, 1000):
picks.extend(Pick.get_by_key_name(slice))
return picks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment