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 top-level dispatch.batch helper function #165

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/dispatch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import dispatch.integrations
from dispatch.coroutine import all, any, call, gather, race
from dispatch.function import DEFAULT_API_URL, Client, Function, Registry, Reset
from dispatch.function import DEFAULT_API_URL, Batch, Client, Function, Registry, Reset
from dispatch.http import Dispatch
from dispatch.id import DispatchID
from dispatch.proto import Call, Error, Input, Output
Expand Down Expand Up @@ -96,3 +96,8 @@ def run(init: Optional[Callable[P, None]] = None, *args: P.args, **kwargs: P.kwa
finally:
server.shutdown()
server.server_close()


def batch() -> Batch:
"""Create a new batch object."""
return default_registry().batch()