meta.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:utils 作者: rapydo 项目源码 文件源码
def get_celery_tasks_from_module(self, submodule):
        """
            Extract all celery tasks from a module.
            Celery tasks are functions decorated by @celery_app.task(...)
            This decorator transform the function into a class child of
            celery.local.PromiseProxy
        """
        tasks = {}
        functions = inspect.getmembers(submodule)
        for func in functions:

            obj_type = type(func[1])

            if obj_type.__module__ != "celery.local":
                continue

            tasks[func[0]] = func[1]
        return tasks
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号