#NEWLINE# def get_config( ) : #NEWLINE# #INDENT# config = [ ] #NEWLINE# def get_matcher( minval , maxval , t ) : #NEWLINE# #INDENT# if ( t == '*' ) : #NEWLINE# #INDENT# return ( lambda x : True ) #NEWLINE# #UNINDENT# parts = re . split ( '\\s*,\\s*' , t ) #NEWLINE# if ( not parts ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# t_parts = [ int ( x ) for x in parts ] #NEWLINE# for num in t_parts : #NEWLINE# #INDENT# assert ( ( num >= minval ) and ( num <= maxval ) ) , ( 'Invalid time specified in cron config. Specified: %s, minval: %s, maxval: %s' % ( num , minval , maxval ) ) #NEWLINE# #UNINDENT# return ( lambda x : ( x in t_parts ) ) #NEWLINE# #UNINDENT# for app_config in apps . get_app_configs ( ) : #NEWLINE# #INDENT# app = app_config . name #NEWLINE# try : #NEWLINE# #INDENT# app_path = __import__ ( app , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , [ app . split ( '.' ) [ ( - 1 ) ] ] ) . __path__ #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# imp . find_module ( 'cron' , app_path ) #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# mod = __import__ ( ( '%s.cron' % app ) , fromlist = ( app , ) ) #NEWLINE# for row in mod . CONFIG : #NEWLINE# #INDENT# row [ 'min_matcher' ] = get_matcher ( 0 , 59 , row . get ( 'minutes' ) ) #NEWLINE# row [ 'hour_matcher' ] = get_matcher ( 0 , 23 , row . get ( 'hours' ) ) #NEWLINE# row [ 'day_matcher' ] = get_matcher ( 1 , 7 , row . get ( 'days' , '*' ) ) #NEWLINE# row [ 'queue' ] = row . get ( 'queue' , 'cron' ) #NEWLINE# row [ 'timeout' ] = row . get ( 'timeout' , None ) #NEWLINE# row [ 'sigkill_on_stop' ] = row . get ( 'sigkill_on_stop' , False ) #NEWLINE# config . append ( row ) #NEWLINE# app_settings . WORKERS . setdefault ( row [ 'queue' ] , 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return app_config