@@ -151,6 +151,7 @@ class OpArgs:
151151 - gpu: Whether the executor will be executed on GPU.
152152 - cache: Whether the executor will be cached.
153153 - batching: Whether the executor will be batched.
154+ - max_batch_size: The maximum batch size for the executor. Only valid if `batching` is True.
154155 - behavior_version: The behavior version of the executor. Cache will be invalidated if it
155156 changes. Must be provided if `cache` is True.
156157 - arg_relationship: It specifies the relationship between an input argument and the output,
@@ -161,6 +162,7 @@ class OpArgs:
161162 gpu : bool = False
162163 cache : bool = False
163164 batching : bool = False
165+ max_batch_size : int | None = None
164166 behavior_version : int | None = None
165167 arg_relationship : tuple [ArgRelationship , str ] | None = None
166168
@@ -389,11 +391,17 @@ def enable_cache(self) -> bool:
389391 def behavior_version (self ) -> int | None :
390392 return op_args .behavior_version
391393
394+ def batching_options (self ) -> dict [str , Any ] | None :
395+ if op_args .batching :
396+ return {
397+ "max_batch_size" : op_args .max_batch_size ,
398+ }
399+ else :
400+ return None
401+
392402 if category == OpCategory .FUNCTION :
393403 _engine .register_function_factory (
394- op_kind ,
395- _EngineFunctionExecutorFactory (spec_loader , _WrappedExecutor ),
396- op_args .batching ,
404+ op_kind , _EngineFunctionExecutorFactory (spec_loader , _WrappedExecutor )
397405 )
398406 else :
399407 raise ValueError (f"Unsupported executor type { category } " )
0 commit comments