You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
663 B
Python
29 lines
663 B
Python
|
|
# Copyright (C) 2018-2022 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from rq import Worker
|
|
|
|
|
|
class BaseDeathPenalty:
|
|
def __init__(self, timeout, exception, **kwargs):
|
|
pass
|
|
|
|
def __enter__(self):
|
|
pass
|
|
|
|
def __exit__(self, exc_type, exc_value, traceback):
|
|
pass
|
|
|
|
|
|
class SimpleWorker(Worker):
|
|
death_penalty_class = BaseDeathPenalty
|
|
|
|
def main_work_horse(self, *args, **kwargs):
|
|
raise NotImplementedError("Test worker does not implement this method")
|
|
|
|
def execute_job(self, *args, **kwargs):
|
|
"""Execute job in same thread/process, do not fork()"""
|
|
return self.perform_job(*args, **kwargs)
|