Skip to content

Commit

Permalink
chore: Allow kwargs only for batch-load function (#3037)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa authored Nov 7, 2024
1 parent 6e542a1 commit 7b6072a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ai/backend/manager/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,9 @@ def get_loader_by_func(
self,
context: ContextT,
batch_load_func: Callable[[ContextT, Sequence[LoaderKeyT]], Awaitable[LoaderResultT]],
*args,
**kwargs,
# Using kwargs-only to prevent argument position confusion
# when DataLoader calls `batch_load_func(keys)` which is `partial(batch_load_func, **extra_args)(keys)`.
**kwargs: Any,
) -> DataLoader:
key = self._get_func_key(batch_load_func)
loader = self.cache.get(key)
Expand All @@ -763,7 +764,6 @@ def get_loader_by_func(
functools.partial(
batch_load_func,
context,
*args,
**kwargs,
),
max_batch_size=128,
Expand Down

0 comments on commit 7b6072a

Please sign in to comment.