<s> import sys <EOL> import gevent <EOL> from optparse import make_option <EOL> from django . conf import settings <EOL> from django . core . management import call_command <EOL> from django . core . management . base import BaseCommand <EOL> class Command ( BaseCommand ) : <EOL> args = '<STR_LIT>' <EOL> help = "<STR_LIT>" <EOL> option_list = BaseCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , action = '<STR_LIT>' , dest = '<STR_LIT>' , default = True , <EOL> help = '<STR_LIT>' ) , <EOL> make_option ( '<STR_LIT>' , action = '<STR_LIT:store_true>' , dest = '<STR_LIT>' , default = False , <EOL> help = '<STR_LIT>' ) , <EOL> make_option ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , dest = '<STR_LIT:list>' , default = False , <EOL> help = '<STR_LIT>' ) , <EOL> ) <EOL> def handle ( self , * args , ** options ) : <EOL> jobs = [ ] <EOL> for db_alias in settings . DATABASES . keys ( ) : <EOL> print '<STR_LIT>' . format ( db_alias ) <EOL> if options [ '<STR_LIT>' ] : <EOL> call_command ( <EOL> '<STR_LIT>' , <EOL> database = db_alias , <EOL> interactive = options [ '<STR_LIT>' ] , <EOL> fake = options [ '<STR_LIT>' ] , <EOL> list = options [ '<STR_LIT:list>' ] , <EOL> ) <EOL> else : <EOL> jobs . append ( gevent . spawn ( <EOL> call_command , <EOL> '<STR_LIT>' , <EOL> database = db_alias , <EOL> interactive = options [ '<STR_LIT>' ] , <EOL> fake = options [ '<STR_LIT>' ] , <EOL> list = options [ '<STR_LIT:list>' ] , <EOL> ) ) <EOL> gevent . joinall ( jobs ) <EOL> success = True <EOL> for job in jobs : <EOL> if not job . successful ( ) : <EOL> print '<STR_LIT>' <EOL> print job . exception <EOL> success = False <EOL> if not success : <EOL> sys . exit ( <NUM_LIT:1> ) </s>
