#NEWLINE# @ contract #NEWLINE# def execute( config , state ) : #NEWLINE# #INDENT# ' Execute an iteration of the database cleaner.\n\n    :param config: A config dictionary.\n     :type config: dict(str: *)\n\n    :param state: A state dictionary.\n     :type state: dict(str: *)\n\n    :return: The updated state dictionary.\n     :rtype: dict(str: *)\n    ' #NEWLINE# datetime_threshold = ( today ( ) - datetime_threshold [ 'time_delta' ] ) #NEWLINE# state [ 'db' ] . cleanup_vm_resource_usage ( datetime_threshold ) #NEWLINE# state [ 'db' ] . cleanup_host_resource_usage ( datetime_threshold ) #NEWLINE# if log . isEnabledFor ( logging . INFO ) : #NEWLINE# #INDENT# log . info ( 'Cleaned up data older than %s' , datetime_threshold . strftime ( '%Y-%m-%d %H:%M:%S' ) ) #NEWLINE# #UNINDENT# return state