News for hackers. Stuff that matters.
Re:Mpire: A Python package for easier and faster multiproces... by jw887c on Friday August 11, 2023 @12:48PM (#37090818)
Multiprocessing is great as a first pass parallelization but I've found that debugging it to be very hard, especially for junior employees.

It seems much easier to follow when you can push everything to horizontally scaled single processes for languages like Python.

Re:Mpire: A Python package for easier and faster multiproces... by uniqueuid on Friday August 11, 2023 @01:03PM (#37090981)
I agree. The main problems aren't syntax, they are architectural: Catching and retrying individual failures in a pool.map, anticipating OOM with heavy tasks, understanding process lifecycle and the underlying pickle/ipc.

All these are much more reliably solved with horizontal scaling.

[edit] by the way, a very useful minimal sugar on top of multiprocessing for one-off tasks is tqdm's process_map, which automatically shows a progress bar https://tqdm.github.io/docs/contrib.concurrent/

Re:Mpire: A Python package for easier and faster multiproces... by xapata on Friday August 11, 2023 @01:20PM (#37091216)
How is coordinating between different machines any different than coordinating between different processes?

A multiprocessing implementation is a good prototype for a distributed implementation.

Re:Mpire: A Python package for easier and faster multiproces... by uniqueuid on Friday August 11, 2023 @01:34PM (#37091415)
To be honest, I don't think both are similar at all.

Parallelizing across machines involves networks, and well, that's why we have jepsen, and byzantine failures, and eventual consistency, and net splits, and leadership election, and discovery - so in short a stack of hard problems that in and of itself is usually much larger than what you're trying to solve with multiprocessing.

Re:Mpire: A Python package for easier and faster multiproces... by xapata on Friday August 11, 2023 @04:01PM (#37093293)
True, the networking causes trouble. I usually rely on a communication layer that addresses those troubles. A good message queue makes the two paradigms quite similar. Or something like Dask (https://www.dask.org/).
Re:Mpire: A Python package for easier and faster multiproces... by Terretta on Friday August 11, 2023 @03:16PM (#37092702)
From the linked Mpire readme:

    Suppose we want to know the status of the current task: how many tasks are
    completed, how long before the work is ready? It's as simple as setting the 
    progress_bar parameter to True:

        with WorkerPool(n_jobs=5) as pool:
            results = pool.map(time_consuming_function, 
                      range(10), progress_bar=True)

    And it will output a nicely formatted tqdm progress bar.
Re:Mpire: A Python package for easier and faster multiproces... by dr_kiszonka on Friday August 11, 2023 @01:25PM (#37091283)
Parsl has quite good debugging facilities built in, which include automatic logging and visualizations.

https://parsl.readthedocs.io/en/stable/faq.html

https://parsl.readthedocs.io/en/stable/userguide/monitoring....

Re:Mpire: A Python package for easier and faster multiproces... by wheelerof4te on Friday August 11, 2023 @01:34PM (#37091422)
Or just use numpy's arrays, which have their integrated multiprocessing.
Re:Mpire: A Python package for easier and faster multiproces... by flakes on Friday August 11, 2023 @01:02PM (#37090968)
Depends on the workflow. For one off jobs or client tooling, parallelism makes sense to have rapid user feedback.

For batch pipelines on that work many requests, having a serial workflow has a lot of the advantages you mention. Serial execution makes the load more predictable and makes scaling easier to rationalize.