#NEWLINE# def get_jobs( when = None , only_scheduled = False ) : #NEWLINE# #INDENT# '\n    Returns a dictionary mapping of job names together with their respective\n    application class.\n    ' #NEWLINE# import sys #NEWLINE# try : #NEWLINE# #INDENT# cpath = os . path . dirname ( os . path . realpath ( sys . argv [ 0 ] ) ) #NEWLINE# ppath = os . path . dirname ( cpath ) #NEWLINE# if ( ppath not in sys . path ) : #NEWLINE# #INDENT# sys . path . append ( ppath ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# _jobs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if True : #NEWLINE# #INDENT# from django.conf import settings #NEWLINE# for app_name in settings . INSTALLED_APPS : #NEWLINE# #INDENT# scandirs = ( None , 'minutely' , 'quarter_hourly' , 'hourly' , 'daily' , 'weekly' , 'monthly' , 'yearly' ) #NEWLINE# if when : #NEWLINE# #INDENT# scandirs = ( None , when ) #NEWLINE# #UNINDENT# for subdir in scandirs : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# path = find_job_module ( app_name , subdir ) #NEWLINE# for name in find_jobs ( path ) : #NEWLINE# #INDENT# if ( ( app_name , name ) in _jobs ) : #NEWLINE# #INDENT# raise JobError ( ( 'Duplicate job %s' % name ) ) #NEWLINE# #UNINDENT# job = import_job ( app_name , name , subdir ) #NEWLINE# if ( only_scheduled and ( job . when is None ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( when and ( job . when != when ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# _jobs [ ( app_name , name ) ] = job #NEWLINE# #UNINDENT# #UNINDENT# except ImportError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return _jobs