load_async
Asynchronously load a UDF from various sources.
await fused.load_async(
url_or_udf: str | Path,
/,
*,
cache_key: Any = None,
import_globals: bool = True
) -> Udf
This is the async-optimized version of fused.load() that uses async HTTP requests to avoid blocking the event loop during UDF metadata fetching.
Parameters
- url_or_udf (
str | Path) – A string representing the location of the UDF, or the raw code of the UDF. - cache_key (
Any) – An optional key used for caching the loaded UDF. - import_globals (
bool) – Expose the globals defined in the UDF's context as attributes on the UDF object.
Returns
Udf– An instance of the loaded UDF.
Example
import fused
# Load a UDF asynchronously
udf = await fused.load_async("username@fused.io/my_udf_name")
# Use in parameter validation
if not isinstance(udf, Udf):
udf = await fused.load_async(udf)
See also
fused.load– Synchronous versionfused.run_async– Run a UDF asynchronously