#NEWLINE# @ cube_app . route ( '/late-cubes' , method = 'GET' ) #NEWLINE# def cube_get_late( mongodb , slug = None ) : #NEWLINE# #INDENT# _cubes = list ( mongodb [ collection ] . find ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : False , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# cubes = [ ] #NEWLINE# for cb in _cubes : #NEWLINE# #INDENT# is_late = False #NEWLINE# if ( cb . get ( 'scheduler_type' , '' ) == 'minutes' ) : #NEWLINE# #INDENT# lu = cb . get ( 'lastupdate' ) #NEWLINE# if isinstance ( lu , datetime . datetime ) : #NEWLINE# #INDENT# n_lu = ( lu + datetime . timedelta ( minutes = int ( cb [ 'scheduler_interval' ] ) ) ) #NEWLINE# if ( ( datetime . datetime . now ( ) - n_lu ) . total_seconds ( ) > 0 ) : #NEWLINE# #INDENT# cb [ 'late' ] = n_lu #NEWLINE# is_late = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( cb . get ( 'scheduler_type' , '' ) == 'hour' ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( cb . get ( 'scheduler_type' , '' ) == 'day' ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if is_late : #NEWLINE# #INDENT# cubes . append ( cb ) #NEWLINE# #UNINDENT# #UNINDENT# return json . dumps ( cubes , default = parse_dumps )