Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MultiThreading and Multiprocessing #71

Open
arshpreetsingh opened this issue Dec 4, 2017 · 4 comments
Open

Support MultiThreading and Multiprocessing #71

arshpreetsingh opened this issue Dec 4, 2017 · 4 comments

Comments

@arshpreetsingh
Copy link

No description provided.

@palnabarun
Copy link
Contributor

Hi @arshpreetsingh

Can you please elaborate on the issue?

@arshpreetsingh
Copy link
Author

Sure, With each function there could be decorator something like where user can control number of threads for specified function, Something like:

@fire_resource(threads=4) # it could use Threading API Or may be joblib in Sklearn
def function_name():
return "running multiple threads"

same if we have to run functions concurrently.
@fire_resource(threads=4,concurrent=True) # it could use Multiprocessing API
def function_name():
return "running concurrent processes"
I just found that when Training a ML function we obviously need multiple threads but when making predictions it's "Really Good" to run it concurrently. Please feel free to ping for more detailed elaboration.

@anandology
Copy link
Member

I think this is a documentation issue. Firefly is a Python WSGI application. It can be run using multiple threads or processes using any WSGI server. The recommended approach is using gunicorn.

To run it using 4 processes:

gunicorn --workers 4 firefly.main.app -e FIREFLY_FUNCTIONS="funcs.square,funcs.cube"

To run using 4 threads:

gunicorn --workers 4 firefly.main.app -e FIREFLY_FUNCTIONS="funcs.square,funcs.cube"

@arshpreetsingh does it answer your question?

@arshpreetsingh
Copy link
Author

Yes, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants