Skip to main content

run_async

Async version of run() that executes a UDF asynchronously.

await fused.run_async(
udf: str | Udf | UdfJobStepConfig | None = None,
*,
x: int | None = None,
y: int | None = None,
z: int | None = None,
engine: Literal['remote', 'local'] | None = None,
instance_type: str | None = None,
type: Literal['tile', 'file'] | None = None,
max_retry: int = 0,
cache_max_age: str | None = None,
cache: bool = True,
parameters: dict[str, Any] | None = None,
disk_size_gb: int | None = None,
**kw_parameters
) -> xr.Dataset | pd.DataFrame | gpd.GeoDataFrame | UdfEvaluationResult

This function provides the same functionality as fused.run() but with async execution.

Parameters

  • udf (str | Udf | UdfJobStepConfig) – The UDF to execute. Can be:
    • A string representing a UDF name or shared token
    • A UDF object
    • A UdfJobStepConfig object for detailed execution configuration
  • x, y, z (int | None) – Tile coordinates for tile-based UDF execution.
  • engine (Literal['remote', 'local'] | None) – The execution engine to use.
  • instance_type (str | None) – Instance type for remote execution ('realtime', 'small', 'medium', 'large', or a specific instance type).
  • type (Literal['tile', 'file'] | None) – The type of UDF execution.
  • max_retry (int) – Maximum retries if the UDF fails. Defaults to 0.
  • cache_max_age (str | None) – Maximum cache age (e.g., "48h", "10s").
  • cache (bool) – Set to False to disable caching.
  • parameters (dict[str, Any] | None) – Additional parameters to pass to the UDF.
  • disk_size_gb (int | None) – Disk size in GB for remote execution (batch only).
  • **kw_parameters – Additional parameters to pass to the UDF.

Returns

The result of the UDF execution, which varies based on the UDF and execution path.

Example

import fused

# Run a UDF saved in the Fused system asynchronously
result = await fused.run_async("username@fused.io/my_udf_name")

# Run a UDF saved in GitHub asynchronously
loaded_udf = fused.load("https://github.com/fusedio/udfs/tree/main/public/Building_Tile_Example")
result = await fused.run_async(loaded_udf, bbox=bbox)

# Run a UDF saved in a local directory asynchronously
loaded_udf = fused.load("/Users/local/dir/Building_Tile_Example")
result = await fused.run_async(loaded_udf, bbox=bbox)

See also