<commit_before>import sys

class Process(object):
    
    def __init__(self):
        pass

    def log(self, msg):
        self.logger.info('{0} for run {1}: {2}'.format(self.__class__.__name__, self.run_name, msg))
    
    def run(self, config):
        try:
            if isinstance(self, HarvesterProcess):
                return self.harvest(config)
            elif isinstance(self, ExtractorProcess):
                return self.extract(config)
        except ProcessError as r:
            return r
        except Exception as e:
            #e_info = sys.exc_info()
            #self.log(''.join(traceback.format_exception(*e_info)))
            return ProcessError('{0}: {1}'.format(e.__class__.__name__, e))    


class HarvesterProcess(Process):
    def harvest(self, config):
        raise ProcessError('Override this method')
    
class ExtractorProcess(Process):
    def extract(self, data):
        raise ProcessError('Override this method')
    

class ProcessError(Exception):
    
    def __init__(self, msg):
        self.msg = msg
        
    def __unicode__(self):
        return "RunnableError: {0}".format(self.msg)<commit_msg>Fix defined exception<commit_after>import sys

class Process(object):
    
    def __init__(self):
        pass

    def log(self, msg):
        self.logger.info('{0} for run {1}: {2}'.format(self.__class__.__name__, self.run_name, msg))
    
    def run(self, config):
        try:
            if isinstance(self, HarvesterProcess):
                return self.harvest(config)
            elif isinstance(self, ExtractorProcess):
                return self.extract(config)
        except ProcessError as r:
            return r
        except Exception as e:
            #e_info = sys.exc_info()
            #self.log(''.join(traceback.format_exception(*e_info)))
            return ProcessError('{0}: {1}'.format(e.__class__.__name__, e))    


class HarvesterProcess(Process):
    def harvest(self, config):
        raise ProcessError('Override this method')
    
class ExtractorProcess(Process):
    def extract(self, data):
        raise ProcessError('Override this method')
    

class ProcessError(Exception):
    pass
    #def __init__(self, message):
    #    super(ProcessError, self).__init__('ProcessError: {}'.format(message))
{'fraction_non_alphanumeric': 0.11503267973856209, 'fraction_numerical': 0.004793028322440087, 'mean_word_length': 2.4578313253012047, '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': '110918', 'n_tokens_mistral': 660, 'n_tokens_neox': 640, 'n_words': 154}