# Path: demo/celery/task/main.py

# 
# Path: falsy/loader/func.py
# def load(function_name):
# def deep_getattr(obj, attr):
# 
# Path: falsy/loader/task.py
# def load(id, args, error_handler=None):
# def loads(payload):
# 
# Path: demo/celery/task/tasks.py
# class ExampleException(Exception):
# def catch(et, ev, es):
# def crawl(self, urls):
# def callback(self, s):
# def on_chord_error(request, exc, traceback):
# def error_callback(*args, **kwargs):
# def post_func(payload, resp):


from time import sleep
from celery import group, chain, chord
from celery.result import AsyncResult
from .main import app
from falsy.loader import func, task
from .tasks import add, on_chord_error


# from ymon.loader.task import loads




if __name__ == '__main__':
    payload = {
        'tasks': [
            {"args": "haha", "ids": ["demo.celery.task.tasks.test2"], "on_error": "demo.celery.task.tasks.on_chord_error"},
        ],
        'callback': "demo.celery.task.tasks.callback"
    }
    res = task.loads(payload).delay()
    sleep(3)
    print(res.result, res.state)
    print(res, type(res), dir(res))

# Path: demo/celery/task/main.py

# 
# Path: falsy/loader/func.py
# def load(function_name):
# def deep_getattr(obj, attr):
# 
# Path: falsy/loader/task.py
# def load(id, args, error_handler=None):
# def loads(payload):
# 
# Path: demo/celery/task/tasks.py
# class ExampleException(Exception):
# def catch(et, ev, es):
# def crawl(self, urls):
# def callback(self, s):
# def on_chord_error(request, exc, traceback):
# def error_callback(*args, **kwargs):
# def post_func(payload, resp):


# Path: demo/celery/task/run.py
from time import sleep
from celery import group, chain, chord
from celery.result import AsyncResult
from .main import app
from falsy.loader import func, task
from .tasks import add, on_chord_error



# from ymon.loader.task import loads




if __name__ == '__main__':
    payload = {
        'tasks': [
            {"args": "haha", "ids": ["demo.celery.task.tasks.test2"], "on_error": "demo.celery.task.tasks.on_chord_error"},
        ],
        'callback': "demo.celery.task.tasks.callback"
    }
    res = task.loads(payload).delay()
    sleep(3)
    print(res.result, res.state)
    print(res, type(res), dir(res))

    print(res.id)