from __future__ import generators import sys import time from functools import partial from itertools import chain, izip from celery.registry import TaskRegistry from celery.task.base import Task from celery.utils import timeutils from celery.utils import gen_unique_id from celery.worker import buckets from celery.tests.utils import skip_if_environ, unittest skip_if_disabled = partial(skip_if_environ("SKIP_RLIMITS")) class MockJob(object): def __init__(self, task_id, task_name, args, kwargs): self.task_id = task_id self.task_name = task_name self.args = args self.kwargs = kwargs def __eq__(self, other): if isinstance(other, self.__class__): return bool(self.task_id == other.task_id \ and self.task_name == other.task_name \ and self.args == other.args \ and self.kwargs == other.kwargs) else: return self == other def __repr__(self): return "