Skip to content

Added request_options parameter to various classes and functions for canceling requests #1190

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emojiiii
Copy link
Contributor

@emojiiii emojiiii commented Feb 12, 2025

Added request_options parameter to various classes and functions for canceling requests

closed #1182

@xenova
Copy link
Collaborator

xenova commented Feb 12, 2025

This can be very useful! Thanks! Regarding the API, since this is pretty non-standard for the python library, perhaps a better approach would be to allow the user to pass their own fetch function instead of only allowing them to pass options? This could be useful for loading models from custom filesystems too.

In fact, I think this would be better at the env level. something like env.fetch = ...

@emojiiii
Copy link
Contributor Author

This can be very useful! Thanks! Regarding the API, since this is pretty non-standard for the python library, perhaps a better approach would be to allow the user to pass their own fetch function instead of only allowing them to pass options? This could be useful for loading models from custom filesystems too.

In fact, I think this would be better at the env level. something like env.fetch = ...

You're right, I need some time to revisit it.

@emojiiii
Copy link
Contributor Author

I added a custom fetch method, but after some thought, I realized that I still need to pass request_options as I do currently. Otherwise, every time an AbortController is used, I would need to reset env.customFetch, and there would be no way to cancel only specific fetches.

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.

There is no way to stop / abort / cancel a pipeline()
2 participants