<commit_before>class QueryTooExpensive(Exception):
  pass

class BackendError(Exception):
  pass

class QPSTooLow(Exception):
  pass

class TableTooLarge(Exception):
  pass

class InternalServerError(Exception):
  pass<commit_msg>Some new code for handling exceptions from multiprocessing<commit_after>import functools
import traceback

class QueryTooExpensive(Exception):
  pass

class BackendError(Exception):
  pass

class QPSTooLow(Exception):
  pass

class TableTooLarge(Exception):
  pass

class InternalServerError(Exception):
  pass

# For logging exceptions from multithreaded pools
# http://stackoverflow.com/a/25384934
def trace_unhandled_exceptions(func):
    @functools.wraps(func)
    def wrapped_func(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except:
            print 'Exception in '+func.__name__
            traceback.print_exc()
    return wrapped_func
{'fraction_non_alphanumeric': 0.08093126385809313, 'fraction_numerical': 0.008869179600886918, 'mean_word_length': 4.375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7015373', 'n_tokens_mistral': 272, 'n_tokens_neox': 266, 'n_words': 64}