Search code examples
pythoncelerydjango-celery

Celery 3.1 - Executing chain of tasks asynchronicaly


Based on "Best Practices" in section "Avoid launching synchronous subtasks" I would like to execute chain in background, not waiting for an job's chain result. How to achieve that ?

Is it that simple as (based on example in link I've provided)?:

def update_page_info(url):
    # fetch_page -> parse_page -> store_page
    chain = fetch_page.s() | parse_page.s() | store_page_info.s(url)
    chain.delay()

Solution

  • Instead of

    chain.delay()
    

    there should be

    chain.apply_async()
    

    The rest looks good.