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.
28 lines
636 B
Python
28 lines
636 B
Python
|
|
# Copyright (C) 2018 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from rq import Worker
|
|
|
|
|
|
class BaseDeathPenalty(object):
|
|
def __init__(self, timeout):
|
|
pass
|
|
|
|
def __enter__(self):
|
|
pass
|
|
|
|
def __exit__(self, type, 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) |