{"id":20630648,"url":"https://github.com/brookisme/mproc","last_synced_at":"2026-04-21T02:03:20.801Z","repository":{"id":57443510,"uuid":"168983107","full_name":"brookisme/mproc","owner":"brookisme","description":"Python Multiprocessing Made Easy","archived":false,"fork":false,"pushed_at":"2019-06-04T00:50:23.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-11T19:12:43.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brookisme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-03T19:16:19.000Z","updated_at":"2021-03-20T17:13:05.000Z","dependencies_parsed_at":"2022-09-11T14:10:55.933Z","dependency_job_id":null,"html_url":"https://github.com/brookisme/mproc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Fmproc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Fmproc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Fmproc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Fmproc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brookisme","download_url":"https://codeload.github.com/brookisme/mproc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242588421,"owners_count":20154203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T14:09:07.462Z","updated_at":"2026-04-21T02:03:20.769Z","avatar_url":"https://github.com/brookisme.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### MPROC\n\n_multiprocessing made easy_\n\n---\n\n#### INSTALL\n\n```bash\ngit clone https://github.com/brookisme/mproc.git\ncd mproc\npip install -e .\n```\n\n---\n\n#### MAP METHODS\n\n```\ndef map_with_pool(map_function,args_list,max_processes=MAX_POOL_PROCESSES)\n```\n\n```\ndef map_with_threadpool(map_function,args_list,max_processes=MAX_THREADPOOL_PROCESSES)\n```\n\n```\ndef map_sequential(map_function,args_list,print_args=False,noisy=False,**dummy_kwargs)\n```\n\n```\n  Args:\n    * map_function \u003cfunction\u003e: \n      a function to map over args list. the function should take a single argument.\n      if multiple arguments are needed accept them as a single list or tuple\n    * args_list \u003clist\u003e: the list of arguments to map over\n    * max_process \u003cint\u003e: number of processes\n      - for max_with_pool defaults to the number of cpus minus 1\n      - for max_with_threadpool defaults to 16\n      - map_sequential ignores this argument as its doesn't actually do \n        any multiprocesssing \n\n  Return:\n    List of return values from map_function\n\n  Notes:\n    map_sequential does NOT multiprocess.  it can be used as a sequential drop-in \n    replacement for map_with_pool/threadpool.  this is useful for:\n      - development \n      - debugging\n      - benchmarking \n```\n\n---\n\n#### MPList\n\nThe above methods are great when you have a single method you are calling multiple times with different arguments.\n\nIf you want to launch a multiple processes/threads for distinct methods and arguments use `MPList`.\n\nThe main instance methods are `append(method,*args,**kwargs)` which adds processes and `run()`  which starts the jobs.  An example might look like:\n\n```python\ndef prediction(im,model_key,window,pad):\n  \"\"\" predict-stuff \"\"\"\n  pass\n\ndef cloud_score(im,window,pad):\n  \"\"\" compute-stuff \"\"\"\n  pass\n\nmp_list=MPList()\nmp_list.append(\n    prediction,\n    im.astype(DTYPE),\n    model_key=model_key,\n    window=window,\n    pad=pad )\nmp_list.append(\n    cloud_score,\n    im,\n    window=window,\n    pad=pad )\npreds,(cmask,cscores)=mp_list.run()\n```\n\n```python\n\"\"\" MPList\nArgs:\n    pool_type\u003cstr\u003e: \n        one of MPList.POOL|THREAD|SEQUENTIAL.  determines which map_function \n        and default max_processes to use. If not MPList.THREAD|SEQUENTIAL it \n        will default to MPList.POOL.\n    max_processes\u003cint\u003e:\n        if not passed will set default based on pool_type\n    jobs\u003clist\u003e:\n        list of (target,args,kwargs) tuples. Note: use the append method rather than\n        creating (target,args,kwargs) tuples\n\"\"\"\n```\n\n\n---\n\n#### PYPI\n\n```bash\npython setup.py sdist\ntwine upload dist/*\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrookisme%2Fmproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrookisme%2Fmproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrookisme%2Fmproc/lists"}