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 8728429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:38:19+00:00 2026-06-13T08:38:19+00:00

I’m trying to use python’s multiprocessing module to run a distributed task over a

  • 0

I’m trying to use python’s multiprocessing module to run a distributed task over a couple of machines, and I’ve been using this blog post as a reference.

However, this post’s task uses a job queue, and puts the results into a results queue, both of which are managed by JobQueueManager (which subclasses SyncManager). This manager has a server which starts, and continually runs until the results queue is filled up, when it calls manager.shutdown().

My issue is that my task doesn’t require a results queue, so I’m trying to figure out how to know when to stop the server. I could have the server run continually with serve_forever, and then manually stop it, or create a dummy queue that fills up in the same way as in the example, and stops the server once it is as big as the original number of jobs.

I’d prefer not to manually stop it, but the second solution seems rather hacky. It seems one common way (without the server) is to call join() on each process, but I don’t know if there’s a way for the manager to find out which process removed each job from the queue.

My fallback plan is a variant of the dummy queue method, but with a shared counter variable that’s incremented as the last step of each process, but I’d like to know if there are any suggestions that use methods from the multiprocessing library, or if this is unreliable.

Thanks

Edit: I didn’t mention that the reason I don’t use a results queue is that I’m storing the results of my processing to a Redis database.

  • 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-13T08:38:20+00:00Added an answer on June 13, 2026 at 8:38 am

    As my update shows, I already use a redis database to store the results of my tasks, so I don’t have to worry about managing a dict between different machines.

    The solution that I ended up going with also uses the Redis db. Whenever each process is done, I have it push a string with the process’ info to a list (r_server.lpush(...) in redis-py). On the server side, instead of using a blocking get method for the result queue, I use Redis’ blocking pop rs.blpop() which works the same way.

    This is pretty much the same as the blog post’s and other suggestions here to make a dummy queue and use get(), but just with redis so I don’t have the overhead of additional method arguments and registering extra methods with the manager.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,

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.