<commit_before># Copyright (C) 2007 <NAME>, http://debain.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
import threading, traceback

class Job(threading.Thread):
    def __init__(self, lock, global_data, action, **kwargs):
        threading.Thread.__init__(self)
        self.global_data_lock = lock
        self.global_data      = global_data
        self.local_data       = {}
        self.action           = action
        self.logfile          = None
        self.logfile_lock     = None
        self.debug            = kwargs.get('debug', 0)
        self.action.debug     = self.debug
        self.exception        = None
        self.setName(self.action.name)


    def run(self):
        """
        Start the actions that are associated with the thread.
        """
        self.exception = None
        if self.debug:
            print "Job running: %s" % self.getName()
        try:
            self.action.execute(self.global_data_lock,
                                self.global_data,
                                self.local_data)
        except Exception, e:
            self.exception = e
            if self.debug:
                name = self.action.name or 'no name'
                print 'Job "%s" (%s) failed: %s' % (self.getName(), name, e)
                traceback.print_exc()
        if self.exception is not None:
            self.action.signal_emit('aborted', self.action, e)
        else:
            self.action.signal_emit('succeeded', self.action)
        self.action.signal_emit('completed', self.action)
<commit_msg>Fix: error reporting when debug level is 0.<commit_after># Copyright (C) 2007 <NAME>, http://debain.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
import threading, traceback

class Job(threading.Thread):
    def __init__(self, lock, global_data, action, **kwargs):
        threading.Thread.__init__(self)
        self.global_data_lock = lock
        self.global_data      = global_data
        self.local_data       = {}
        self.action           = action
        self.logfile          = None
        self.logfile_lock     = None
        self.debug            = kwargs.get('debug', 0)
        self.action.debug     = self.debug
        self.exception        = None
        self.setName(self.action.name)


    def run(self):
        """
        Start the actions that are associated with the thread.
        """
        self.exception = None
        if self.debug:
            print "Job running: %s" % self.getName()
        try:
            self.action.execute(self.global_data_lock,
                                self.global_data,
                                self.local_data)
        except Exception, e:
            self.exception = e
            self.action.signal_emit('aborted',   self.action, e)
            self.action.signal_emit('completed', self.action)
            raise
        self.action.signal_emit('succeeded', self.action)
        self.action.signal_emit('completed', self.action)

{'fraction_non_alphanumeric': 0.08449687048627828, 'fraction_numerical': 0.009870004814636495, 'mean_word_length': 2.1146926536731634, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6933997', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1078, 'n_words': 383}