@fused.udf
udf(
fn: Optional[Callable] = None,
*,
name: Optional[str] = None,
cache_max_age: Optional[str] = None,
instance_type: Optional[str] = None,
disk_size_gb: Optional[int] = None,
region: Optional[str] = None,
default_parameters: Optional[Dict[str, Any]] = None,
headers: Optional[Sequence[Union[str, Header]]] = None,
**kwargs: dict[str, Any]
) -> Callable[..., Udf]
A decorator that transforms a function into a Fused UDF.
Parameters
-
name (
Optional[str]) – The name of the UDF object. Defaults to the name of the function. -
cache_max_age (
Optional[str]) – The maximum age when returning a result from the cache. -
instance_type (
Optional[str]) – The type of instance to use for remote execution ('realtime', or 'small', 'medium', 'large' or one of the whitelisted instance types). If not specified (and also not specified infused.run()), defaults to 'realtime'. -
disk_size_gb (
Optional[int]) – The size of the disk in GB to use for remote execution (only supported for a batch instance type). -
default_parameters (
Optional[Dict[str, Any]]) – Parameters to embed in the UDF object, separately from the arguments list of the function. Defaults to None for empty parameters. -
headers (
Optional[Sequence[Union[str, Header]]]) – A list of files to include as modules when running the UDF. For example, when specifyingheaders=['my_header.py'], inside the UDF function it may be referenced as:import my_header
my_header.my_function()Defaults to None for no headers.
Returns
Callable[..., Udf]– A callable that represents the transformed UDF.
Example
@fused.udf
def udf(bbox, table_path="s3://fused-asset/infra/building_msft_us"):
...
gdf = table_to_tile(bbox, table=table_path)
return gdf