Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:15:36+00:00 2026-06-13T01:15:36+00:00

Can I use a Celery Group primitive as the umbrella task in a map/reduce

  • 0

Can I use a Celery Group primitive as the umbrella task in a map/reduce workflow?

Or more specific: Can the subtasks in a Group be run on multiple workers on multiple servers?

From the docs:

However, if you call apply_async on the group it will send a special 
grouping task, so that the action of calling the tasks happens in a worker 
instead of the current process

That seems to imply the tasks are all send to one worker…

Before 3.0 (and still) one could fire off the subtasks in a TaskSet which would run on multiple servers. The problem is determining whether all tasks have finished executing. That is normally done by polling all subtasks which is not really elegant.
I am wondering if the Group primitive can be used to mitigate this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:15:37+00:00Added an answer on June 13, 2026 at 1:15 am

    I found out it is possible to use Chords for such a map reduce like problem.

    @celery.task(name='ic.mapper')
    def mapper():
        #split your problem in embarrassingly parallel maps 
        maps = [map.s(), map.s(), map.s(), map.s(), map.s(), map.s(), map.s(), map.s()]
        #and put them in a chord that executes them in parallel and after they finish calls 'reduce'
        mapreduce = celery.chord(maps)(reduce.s())    
        return "{0} mapper ran on {1}".format(celery.current_task.request.id, celery.current_task.request.hostname)
    
    @celery.task(name='ic.map')
    def map():
        #do something useful here
        import time
        time.sleep(10.0)
        return "{0} map ran on {1}".format(celery.current_task.request.id, celery.current_task.request.hostname)
    
    @celery.task(name='ic.reduce')
    def reduce(results):
        #put the maps together and do something with the results
        return "{0} reduce ran on {1}".format(celery.current_task.request.id, celery.current_task.request.hostname)
    

    When the mapper is executed on a cluster of three workers/servers it first executes the mapper which splits your problem and the creates new subtasks that are again submitted to the broker. These run in parallel because the queue is consumed by all brokers. Also an chord task is created that polls all maps to see if they have finished. When done the reduce task is executed where you can glue your results back together.

    In all: yes it is possible. Thanks for the vegetable guys!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can use stat() to figure out what permissions the owner, group, or others
I'm wondering how to setup a more specific logging system. All my tasks use
I need in my django project run long tasks. Desided to use celery with
How can I use two different celery project which consumes messages from single RabbitMQ
I use Celery to run web spiders which crawl some data, and after that
Can use select into with multiple cte? for example in the below code the
You can use more than one css class in an HTML tag in current
I know (but I do not understand) that Celery can use Beanstalk as delivery
I use: Celery Django-Celery RabbitMQ I can see all my tasks in the Django
I can use the following to get the contents of a folder with no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.