<s> import logging <EOL> import redis <EOL> import requests <EOL> import tornadoredis <EOL> from rq . decorators import job <EOL> import crosspost <EOL> import models <EOL> r = redis . StrictRedis ( host = '<STR_LIT:localhost>' , port = <NUM_LIT> ) <EOL> @ job ( '<STR_LIT>' , connection = r ) <EOL> def calculate_streaks ( user ) : <EOL> if not user : <EOL> return <EOL> r = tornadoredis . Client ( ) <EOL> r . connect ( ) <EOL> user . calculate_streaks ( r ) <EOL> @ job ( '<STR_LIT>' , connection = r ) <EOL> def crosspost_run ( run ) : <EOL> crosspost . export_run ( run ) <EOL> @ job ( '<STR_LIT>' , connection = r ) <EOL> def crosspost_user ( user ) : <EOL> runs = models . Run . objects ( user = user ) <EOL> for run in runs : <EOL> if not run . exported_to_dailymile : <EOL> crosspost_run . delay ( run ) </s>
