astrobase/lcproc/awsrun.py
def cache_clean_handler(min_age_hours=1):
    """This periodically cleans up the ~/.astrobase cache to save us from
    disk-space doom.

    Parameters
    ----------

    min_age_hours : int
        Files older than this number of hours from the current time will be
        deleted.

    Returns
    -------

    Nothing.

    """

    # find the files to delete
    cmd = (
        "find ~ec2-user/.astrobase -type f -mmin +{mmin} -exec rm -v '{{}}' \;"
    )
    mmin = '%.1f' % (min_age_hours*60.0)
    cmd = cmd.format(mmin=mmin)

    try:
        proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
        ndeleted = len(proc.stdout.decode().split('\n'))
        LOGWARNING('cache clean: %s files older than %s hours deleted' %
                   (ndeleted, min_age_hours))
    except Exception as e:
        LOGEXCEPTION('cache clean: could not delete old files')
def cache_clean_handler(min_age_hours=1):
    """This periodically cleans up the ~/.astrobase cache to save us from
    disk-space doom.

    Parameters
    ----------

    min_age_hours : int
        Files older than this number of hours from the current time will be
        deleted.

    Returns
    -------

    Nothing.

    """

    # find the files to delete
    cmd = (
        "find ~ec2-user/.astrobase -type f -mmin +{mmin} -exec rm -v '{{}}' \;"
    )
    mmin = '%.1f' % (min_age_hours*60.0)
    cmd = cmd.format(mmin=mmin)

    try:
        proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
        ndeleted = len(proc.stdout.decode().split('\n'))
        LOGWARNING('cache clean: %s files older than %s hours deleted' %
                   (ndeleted, min_age_hours))
    except Exception as e:
        LOGEXCEPTION('cache clean: could not delete old files')
def cache_clean_handler ( min_age_hours = 1 ) : # find the files to delete cmd = ( "find ~ec2-user/.astrobase -type f -mmin +{mmin} -exec rm -v '{{}}' \;" ) mmin = '%.1f' % ( min_age_hours * 60.0 ) cmd = cmd . format ( mmin = mmin ) try : proc = subprocess . run ( cmd , shell = True , stdout = subprocess . PIPE ) ndeleted = len ( proc . stdout . decode ( ) . split ( '\n' ) ) LOGWARNING ( 'cache clean: %s files older than %s hours deleted' % ( ndeleted , min_age_hours ) ) except Exception as e : LOGEXCEPTION ( 'cache clean: could not delete old files' )
This periodically cleans up the ~/.astrobase cache to save us from
    disk-space doom.

    Parameters
    ----------

    min_age_hours : int
        Files older than this number of hours from the current time will be
        deleted.

    Returns
    -------

    Nothing.
This periodically cleans up the ~ / . astrobase cache to save us from disk - space doom .