Пример #1
0
def main():

    invalid_cids_filename = '%s/invalid_content_ids.log' % ANALYSIS_RESULTS_DIR

    for content_id in FEW_CONTENT_IDS:
        is_valid, res = process_content(content_id)

        if not is_valid:
            message = 'Invalid content id (%s):\n%s\n' % \
                      (str(content_id),
                       res['outcome_message'])
            dump_data([message], invalid_cids_filename)
Пример #2
0
def process_and_log_content(content_name, trace_recs):
    content_id = tuple(content_name.split('_'))
    invalid_cids_filename = '%s/invalid_content_ids.log' % ANALYSIS_RESULTS_DIR
    processed_cids_filename = '%s/processed_content_ids.log' % ANALYSIS_RESULTS_DIR

    try:
        is_valid, res = process_content(content_id, trace_recs)
    except Exception:
        is_valid = False
        res = {'outcome_message': traceback.format_exc()}

    if not is_valid:
        message = 'Invalid content id (%s): %s' % (str(content_id),
                                                   res['outcome_message'])
        dump_data([message], invalid_cids_filename)

    dump_data([str(content_id)], processed_cids_filename)
Пример #3
0
 def dump_invalid_recs(self):
     if self.invalid_recs:
         filename = '%s/invalid_trace_recs.log' % self.dir
         dump_data(self.invalid_recs, filename)