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

Add concurrency_limiter #223

Merged
merged 5 commits into from
Apr 24, 2024

Conversation

kajarenc
Copy link
Contributor

@kajarenc kajarenc commented Mar 22, 2024

A concurrency limiter decorator could be used to limit the concurrent execution of functions. Could be useful for heavy computation/memory tasks, or when a task to requests to API with rate limits.

@concurrency_limiter(max_concurrency=1)
def heavy_computation():
    st.write("Heavy computation")
    progress_text = "Operation in progress. Please wait."
    my_bar = st.progress(0, text=progress_text)

    for percent_complete in range(100):
        time.sleep(0.15)
        my_bar.progress(percent_complete + 1, text=progress_text)
    st.write("END OF Heavy computation")
    return 42


my_button = st.button("Run heavy computation")

Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for phenomenal-crepe-0effec ready!

Name Link
🔨 Latest commit 8d23420
🔍 Latest deploy log https://app.netlify.com/sites/phenomenal-crepe-0effec/deploys/6629148b298fe400081ddca2
😎 Deploy Preview https://deploy-preview-223--phenomenal-crepe-0effec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kajarenc kajarenc marked this pull request as ready for review April 3, 2024 15:21
Copy link
Owner

@arnaudmiribel arnaudmiribel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kajarenc thanks a ton for this! I think this is looking great. Could you please fetch from main? I think this will solve the documentation build (your fork is a bit outdated with the main branch).

@arnaudmiribel arnaudmiribel merged commit cbfb787 into arnaudmiribel:main Apr 24, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants