Skip to content

Commit

Permalink
fix max_process exceeding number of cores
Browse files Browse the repository at this point in the history
  • Loading branch information
imneonizer authored Nov 16, 2019
1 parent fcebfab commit d0ae933
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
Binary file added dist/improcess-1.1.tar.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions improcess/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from improcess.improcess import multi_processing, console_log
import time

__version__='1.1'
__author__='Nitin Rai'

st = 0
#default start function for spawning process
def start(processing_func, data=None, repeat=None, max_process=4):
assert type(max_process) == int, 'max_process value should be an integer'
assert max_process>0, 'max_process value cannot be less than 1'
Expand All @@ -22,6 +26,7 @@ def start(processing_func, data=None, repeat=None, max_process=4):
else:
print(f'data: {data}, repeat: {repeat}')


def stop():
raise Exception('stop_process')

Expand Down
Binary file modified improcess/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified improcess/__pycache__/improcess.cpython-37.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions improcess/improcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def start(self, raw_data):

if process_count < self.max_process:
self.max_process = process_count
elif process_count > multiprocessing.cpu_count():
self.max_process = multiprocessing.cpu_count()

#number of process to create
pool = multiprocessing.Pool(processes = process_count)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
setup(
name = 'improcess', # How you named your package folder (MyLib)
packages = ['improcess'], # Chose the same as "name"
version = '1.0', # Start with a small number and increase it with every change you make
version = '1.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'This short little python module can help you with running your iteratable functions on multi process without any hassle of creating process by yourself.', # Give a short description about your library
author = 'Nitin Rai', # Type in your name
author_email = '[email protected]', # Type in your E-Mail
url = 'https://github.com/imneonizer/improcess', # Provide either the link to your github or to your website
download_url = 'https://github.com/imneonizer/improcess/archive/v1.0.tar.gz', # I explain this later on
download_url = 'https://github.com/imneonizer/improcess/archive/v1.1.tar.gz', # I explain this later on
keywords = ['Multi Processing', 'Synchronous Processing', 'Parallel execution'], # Keywords that define your package best
classifiers=[
'Development Status :: 4 - Beta', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
Expand Down

0 comments on commit d0ae933

Please sign in to comment.