def _remove_processed_data(
            self):
        """*remove processed data*
        """
        self.log.info('starting the ``_remove_processed_data`` method')

        archivePath = self.settings["atlas archive path"]

        from fundamentals.mysql import readquery
        sqlQuery = u"""
            select mjd from (SELECT DISTINCT
    FLOOR(mjd) as mjd
FROM
    atlas_exposures
WHERE
    local_data = 1 AND dophot_match > 0) as a
        where mjd NOT IN (SELECT 
            *
        FROM
            (SELECT DISTINCT
                FLOOR(mjd)
            FROM
                atlas_exposures
            WHERE
                local_data = 1 AND dophot_match = 0) AS a);
        """ % locals()
        mjds = readquery(
            log=self.log,
            sqlQuery=sqlQuery,
            dbConn=self.atlasMoversDBConn
        )

        if not len(mjds):
            return None

        oldMjds = []
        oldMjds[:] = [str(int(o["mjd"])) for o in mjds]

        for m in oldMjds:
            for i in ["01a", "02a"]:
                datapath = archivePath + "/%(i)s/%(m)s" % locals()
                # shutil.rmtree(datapath)
                try:
                    shutil.rmtree(datapath)
                except:
                    self.log.warning(
                        "The path %(datapath)s does not exist - no need to delete" % locals())

        mjdString = (',').join(oldMjds)

        sqlQuery = """
update day_tracker set local_data = 0 where floor(mjd) in (%(mjdString)s);
update  atlas_exposures set local_data = 0 where floor(mjd) in (%(mjdString)s) and dophot_match != 0;""" % locals(
        )
        print sqlQuery
        writequery(
            log=self.log,
            sqlQuery=sqlQuery,
            dbConn=self.atlasMoversDBConn
        )

        self.log.info('completed the ``_remove_processed_data`` method')
        return None
def _remove_processed_data ( self ) : self . log . info ( 'starting the ``_remove_processed_data`` method' ) archivePath = self . settings [ "atlas archive path" ] from fundamentals . mysql import readquery sqlQuery = u"""
            select mjd from (SELECT DISTINCT
    FLOOR(mjd) as mjd
FROM
    atlas_exposures
WHERE
    local_data = 1 AND dophot_match > 0) as a
        where mjd NOT IN (SELECT 
            *
        FROM
            (SELECT DISTINCT
                FLOOR(mjd)
            FROM
                atlas_exposures
            WHERE
                local_data = 1 AND dophot_match = 0) AS a);
        """ % locals ( ) mjds = readquery ( log = self . log , sqlQuery = sqlQuery , dbConn = self . atlasMoversDBConn ) if not len ( mjds ) : return None oldMjds = [ ] oldMjds [ : ] = [ str ( int ( o [ "mjd" ] ) ) for o in mjds ] for m in oldMjds : for i in [ "01a" , "02a" ] : datapath = archivePath + "/%(i)s/%(m)s" % locals ( ) try : shutil . rmtree ( datapath ) except : self . log . warning ( "The path %(datapath)s does not exist - no need to delete" % locals ( ) ) mjdString = ( ',' ) . join ( oldMjds ) sqlQuery = """
update day_tracker set local_data = 0 where floor(mjd) in (%(mjdString)s);
update  atlas_exposures set local_data = 0 where floor(mjd) in (%(mjdString)s) and dophot_match != 0;""" % locals ( ) print sqlQuery writequery ( log = self . log , sqlQuery = sqlQuery , dbConn = self . atlasMoversDBConn ) self . log . info ( 'completed the ``_remove_processed_data`` method' ) return None
*remove processed data*