multiprocessing

Can a process in Python multiprocessing start another process?

Can a process in Python multiprocessing start another process? Question: A long time ago, I had once faced the problem a long time ago with some library (I don’t recall which) that certain processes/threads (not the main process/threads) cannot create another thread. I am currently using asyncio and multiprocessing for creating separate threads of execution. …

Total answers: 2

Which multiprocessing method map or apply_async?

Which multiprocessing method map or apply_async? Question: I have a function: def movingWinStretch(u0,u1): # u0,u1 are 1D arrays # do a bunch of stuff to u0 and u1 return C , epsArray, tSamp When I do this workflow on smaller amounts of data I use a couple of nested for loops to loop through the …

Total answers: 2

After thread and process close, the MainThread still running

After thread and process close, the MainThread still running Question: I’m a begineer in Python Parallel Programming, my problem is why my code still running after the thread and process close. I’m try use this two function to check which is still alive : print(f"thread : {threading.enumerate()}") print(f"process : {multiprocessing.active_children()}") and it return thread : …

Total answers: 2

Parallel while loop with unknown number of calls

Parallel while loop with unknown number of calls Question: I have written a function that does some calculations, and that everytime it is called it returns a different result, since it uses a different seed for the random number generator. In general, I want to run this functions many times, in order to obtain many …

Total answers: 1

Gracefully handling keyboard interrupt for Python multi-processing

Gracefully handling keyboard interrupt for Python multi-processing Question: I am working on a project which runs two separate python processes. When I do a ctrl + c to end the program, I would like the program to end gracefully. I can produce a minimum working version of the code through the following: from multiprocessing import …

Total answers: 1

Multiprocessing taking more time

Multiprocessing taking more time Question: from multiprocessing import Pool from datetime import datetime import time def elapsed_time(start_time,calling_func): delta = (time.time() – start_time) #print("Took "+str(round(delta/60,3))+" min time for "+calling_func+" to complete") print("Took "+str(round(delta/60,3))+" mins "+calling_func) l =[] squared = [] squared1 = [] for i in range(10): l.append(i) ################### TRADITIONAL ############### def square(): start_time = time.time() …

Total answers: 2

Multiprocessing Manager Dict not updating across multiple processes

Multiprocessing Manager Dict not updating across multiple processes Question: I have a problem using the multiprocessing manager with dicts, to share values across all my processes. I am sure I have the basics right, but somehow I am just missing something… Here is the Minimal repuducable example of my problem: from multiprocessing import Process, Manager …

Total answers: 1

How to make inference from a model using Lambda?

How to make inference from a model using Lambda? Question: I trained an image segmentation model with Mask-RCNN and my goal now is to make inference using AWS Lambda, for this I am modifying the Deploy multiple machine learning models for inference on AWS Lambda and Amazon EFS, my project tree is: . ├── Dockerfile …

Total answers: 1

parallelization of downloading thousands of files using wget

parallelization of downloading thousands of files using wget Question: I have thousands of the files like below to be downloaded. urls = [‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0450.061.2019001110251.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0455.061.2019001110452.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0500.061.2019001110658.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0535.061.2019001110116.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0555.061.2019001132709.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0615.061.2019001132734.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0630.061.2019001132950.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0635.061.2019001133203.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0650.061.2019001132727.hdf’, ‘https://ladsweb.modaps.eosdis.nasa.gov//archive/allData/61/MOD03/2019/001/MOD03.A2019001.0655.061.2019001132653.hdf’] I can download them one by one using wget as follows. #wget is here, https://eternallybored.org/misc/wget/1.21.3/64/wget.exe import os, glob, subprocess import itertools import multiprocessing …

Total answers: 3