#NEWLINE# def dequeue( self ) : #NEWLINE# #INDENT# 'Dequeues the front-most job from this queue.\n\n        Returns a Job instance, which can be executed or inspected.\n        Does not respect serial queue locks\n        ' #NEWLINE# with transaction . commit_on_success ( using = self . connection ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# job = Job . objects . using ( self . connection ) . select_for_update ( ) . filter ( queue = self , status = Job . QUEUED , scheduled_for__lte = now ( ) ) . order_by ( 'scheduled_for' ) [ 0 ] #NEWLINE# job . queue = None #NEWLINE# job . save ( ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# job = None #NEWLINE# #UNINDENT# #UNINDENT# if ( job and job . repeat ) : #NEWLINE# #INDENT# self . enqueue_next ( job ) #NEWLINE# #UNINDENT# return job