def _purge_jobs(timestamp):
 with _get_serv() as cur:
  try:
   sql = 'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)'
   cur.execute(sql, (timestamp,))
   cur.execute('COMMIT')
  except MySQLdb.Error as e:
   log.error("mysql returner archiver was unable to delete contents of table 'jids'")
   log.error(str(e))
   raise salt.exceptions.Salt(str(e))
  try:
   sql = 'delete from `salt_returns` where alter_time < %s'
   cur.execute(sql, (timestamp,))
   cur.execute('COMMIT')
  except MySQLdb.Error as e:
   log.error("mysql returner archiver was unable to delete contents of table 'salt_returns'")
   log.error(str(e))
   raise salt.exceptions.Salt(str(e))
  try:
   sql = 'delete from `salt_events` where alter_time < %s'
   cur.execute(sql, (timestamp,))
   cur.execute('COMMIT')
  except MySQLdb.Error as e:
   log.error("mysql returner archiver was unable to delete contents of table 'salt_events'")
   log.error(str(e))
   raise salt.exceptions.Salt(str(e))
 return True

def _purge_jobs ( timestamp ) : with _get_serv ( ) as cur : try : sql = 'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)' cur . execute ( sql , ( timestamp , ) ) cur . execute ( 'COMMIT' ) except MySQLdb . Error as e : log . error ( "mysql returner archiver was unable to delete contents of table 'jids'" ) log . error ( str ( e ) ) raise salt . exceptions . Salt ( str ( e ) ) try : sql = 'delete from `salt_returns` where alter_time < %s' cur . execute ( sql , ( timestamp , ) ) cur . execute ( 'COMMIT' ) except MySQLdb . Error as e : log . error ( "mysql returner archiver was unable to delete contents of table 'salt_returns'" ) log . error ( str ( e ) ) raise salt . exceptions . Salt ( str ( e ) ) try : sql = 'delete from `salt_events` where alter_time < %s' cur . execute ( sql , ( timestamp , ) ) cur . execute ( 'COMMIT' ) except MySQLdb . Error as e : log . error ( "mysql returner archiver was unable to delete contents of table 'salt_events'" ) log . error ( str ( e ) ) raise salt . exceptions . Salt ( str ( e ) ) return True
purge records from the returner tables .