<commit_before>from rq import Connection, Queue, Worker
from worker.exceptions import WorkerException


def worker_exc_handler(job, exc_type, exc_value, traceback):
    if isinstance(exc_type, WorkerException):
        job.meta['exc_code'] = exc_type.code
        job.meta['exc_message'] = exc_type.message
    return True


def main():
    with Connection():
        q = Queue()
        worker = Worker([q])
        worker.push_exc_handler(worker_exc_handler)
        worker.work()

if __name__ == '__main__':
    main()
<commit_msg>Fix exception subclass in worker exception handler<commit_after>from rq import Connection, Queue, Worker
from worker.exceptions import WorkerException


def worker_exc_handler(job, exc_type, exc_value, traceback):
    if issubclass(exc_type, WorkerException):
        job.meta['exc_code'] = exc_type.code
        job.meta['exc_message'] = exc_type.message
    return True


def main():
    with Connection():
        q = Queue()
        worker = Worker([q])
        worker.push_exc_handler(worker_exc_handler)
        worker.work()

if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.10316742081447963, 'fraction_numerical': 0.0, 'mean_word_length': 3.5142857142857142, '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': '4973073', 'n_tokens_mistral': 344, 'n_tokens_neox': 338, 'n_words': 82}