Esempio n. 1
0
 def log(self, action, metadata):
     j_info(app='translations',
            src='gengo_human',
            action=action,
            msg='order event',
            instance=self,
            metadata=metadata)
Esempio n. 2
0
def purge_data(cutoff=None, verbose=False):
    """Implements data purging per our data retention policy"""
    responses_to_update = set()

    if cutoff is None:
        # Default to wiping out 180 days ago which is roughly 6 months.
        cutoff = datetime.now() - timedelta(days=180)

    # First, ResponseEmail.
    objs = ResponseEmail.objects.filter(opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg = 'feedback_responseemail: %d, ' % (count, )

    # Second, ResponseContext.
    objs = ResponseContext.objects.filter(opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg += 'feedback_responsecontext: %d, ' % (count, )

    # Third, ResponsePI.
    objs = ResponsePI.objects.filter(opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg += 'feedback_responsepi: %d' % (count, )

    j_info(app='feedback', src='purge_data', action='purge_data', msg=msg)

    if responses_to_update:
        index_chunk(ResponseMappingType, list(responses_to_update))
Esempio n. 3
0
 def log(self, action, metadata):
     j_info(
         app='translations',
         src='gengo_human',
         action=action,
         msg='order event',
         instance=self,
         metadata=metadata
     )
Esempio n. 4
0
    def log_info(self, instance, action='translate', msg=u'', metadata=None):
        metadata = metadata or {}

        j_info(app='translations',
               src=self.name,
               action=action,
               msg=msg,
               instance=instance,
               metadata=metadata)
Esempio n. 5
0
    def log_info(self, instance, action='translate', msg=u'', metadata=None):
        metadata = metadata or {}

        j_info(
            app='translations',
            src=self.name,
            action=action,
            msg=msg,
            instance=instance,
            metadata=metadata
        )
Esempio n. 6
0
File: data.py Progetto: xrile/fjord
def purge_data(verbose=False):
    """Implements data purging across the project per data retention policy"""
    # We import these here so there's no way we could have circular
    # imports.
    from fjord.journal.utils import j_info  # noqa

    msg = ''

    # For each registered purge function, run it and print output if verbose
    for purger in get_purgers():
        out = purger()
        if verbose:
            print out
        msg = msg + out + '\n'

    # Log all output to the journal
    j_info(app='base', src='purge_data', action='purge_data', msg=msg)
Esempio n. 7
0
def purge_data(verbose=False):
    """Implements data purging across the project per data retention policy"""
    # We import these here so there's no way we could have circular
    # imports.
    from fjord.journal.utils import j_info  # noqa

    msg = ''

    # For each registered purge function, run it and print output if verbose
    for purger in get_purgers():
        out = purger()
        if verbose:
            print out
        msg = msg + out + '\n'

    # Log all output to the journal
    j_info(app='base',
           src='purge_data',
           action='purge_data',
           msg=msg)
Esempio n. 8
0
File: models.py Progetto: rlr/fjord
def purge_data(cutoff=None, verbose=False):
    """Implements data purging per our data retention policy"""
    responses_to_update = set()

    if cutoff is None:
        # Default to wiping out 180 days ago which is roughly 6 months.
        cutoff = datetime.now() - timedelta(days=180)

    # First, ResponseEmail.
    objs = ResponseEmail.objects.filter(opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg = 'feedback_responseemail: %d, ' % (count, )

    # Second, ResponseContext.
    objs = ResponseContext.objects.filter(opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg += 'feedback_responsecontext: %d, ' % (count, )

    # Third, ResponsePI.
    objs = ResponsePI.objects.filter(
        opinion__created__lte=cutoff)
    responses_to_update.update(objs.values_list('opinion_id', flat=True))
    count = objs.count()
    objs.delete()
    msg += 'feedback_responsepi: %d' % (count, )

    j_info(app='feedback',
           src='purge_data',
           action='purge_data',
           msg=msg)

    if responses_to_update:
        index_chunk(ResponseMappingType, list(responses_to_update))
Esempio n. 9
0
 def log(self, action, metadata):
     j_info(
         app="translations", src="gengo_human", action=action, msg="order event", instance=self, metadata=metadata
     )
Esempio n. 10
0
    def log_info(self, instance, action="translate", msg=u"", metadata=None):
        metadata = metadata or {}

        j_info(app="translations", src=self.name, action=action, msg=msg, instance=instance, metadata=metadata)