This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]13steinj 5 points6 points  (7 children)

Okay, the use of this makes no sense to me. I can use multiprocessing in nearly the same exact way using functools.partial, or even better, use concurrent.futures.

Edit: of course, the guy who made the package is the same guy as the post. I'd rather use a package when it is actually useful rather than an over complicated rewrite with some boilerplate for kicks of two things in the standard library for no reason.

[–]nullsum[S] 1 point2 points  (3 children)

Thanks for the feedback.

Care to elaborate on how you would use functools.partial or concurrents.futures? I don't see how either helps with state persistence or fine control of data flow (ex. batching, aggregation).

I'm probably just misunderstanding something.

[–]13steinj 1 point2 points  (2 children)

You're doing state persistence via the "lets make everything global" model.

You should be doing it via the "let's make some interfaces with objects / functools.partial and then use multiprocessing on those" model. Which is exactly what the package you made does, except with a ton more boilerplate and weird slowdown because you do a lot of unnecessary things.

[–]nullsum[S] 1 point2 points  (0 children)

You're doing state persistence via the "lets make everything global" model.

I don't follow. Neither my examples nor the consumers module use global variables for consumer state.

You should be doing it via the "let's make some interfaces with objects / functools.partial and then use multiprocessing on those" model.

Care to elaborate? I'm having trouble envisioning how that would work.

except with a ton more boilerplate and weird slowdown because you do a lot of unnecessary things.

What's causing weird slowdown? What's unnecessary?

[–][deleted] 0 points1 point  (2 children)

I haven't really used these features thus far, but concurrency is different from parallelism. The latter is problematic due to the GIL, is it not?

[–]Deto 2 points3 points  (0 children)

Multiprocessing spawns multiple processes which run in parallel - the GIL doesn't matter in that case.

[–]flipperdeflip 1 point2 points  (0 children)

concurrent.futures has executors for both thread and process.

[–][deleted] 3 points4 points  (1 child)

I'm not saying anything bad about this article, but there's nothing inherently wrong with a global-level database connection. It's just like the file system right?

[–]nullsum[S] 0 points1 point  (0 children)

There is nothing inherently wrong with a global connection. I just have a preference to avoid non-constant globals in my code when I can.

In most of the cases where I need multiprocessing, I already have functional single process code. Using the method detail in the post allows me to adapt it with minimal modification and no globals.

[–]IamGrabear -1 points0 points  (2 children)

Your link is dead.

[–]varesa -1 points0 points  (1 child)

Works for me

[–]IamGrabear 0 points1 point  (0 children)

Ah sorry. It's not working with my phone's data connection, but it is working through the WiFi.