App
classgworker_client.app.App
Top-level registry. Holds the IR graph for all tasks and classes defined in your app. Pass the app name to the constructor — it must match the name used in gworker.toml.
Class
1class AppMethods
attach_runtime
1attach_runtime(runtime: Any) -> NoneAttach a local runtime for dev/test execution without hitting the remote. Called automatically by the test harness; rarely needed directly.
to_graph
1to_graph() -> AppGraphSerialize the app's IR graph into a JSON-serialisable dict. Used by the CLI to bundle the graph into the deploy tarball.
task
1task(image: Image | None = None, gpu: Gpu | str | None = None, cpu: float | None = None, memory: int | None = None, ephemeral_disk: int | None = None, timeout: int = 300, min_workers: int = 0, max_workers: int = 100, region: Region | str | None = None, secrets: Iterable[Secret] | None = None, volumes: dict[str, Volume] | None = None, mounts: Iterable[Mount] | None = None, cloud_mounts: Iterable[CloudBucketMount] | None = None, kvs: Iterable[KV] | None = None, queues: Iterable[Queue] | None = None, environment: Environment | str | None = None, proxy: Proxy | str | None = None, schedule: ScheduleArg = None, retries: Retries | int | None = None, tags: dict[str, str] | None = None) -> Callable[[Callable[..., Any]], _TaskHandle[Any, Any]]Decorator that registers an async function as a remote task. Returns a _TaskHandle you can call with .run(), .spawn(), or .map(). Resource params (gpu, memory, …) are baked into the deploy IR; they cannot change at call time.
cls
1cls(image: Image | None = None, gpu: Gpu | str | None = None, cpu: float | None = None, memory: int | None = None, timeout: int = 300, min_workers: int = 0, max_workers: int = 100, region: Region | str | None = None, secrets: Iterable[Secret] | None = None, volumes: dict[str, Volume] | None = None, cloud_mounts: Iterable[CloudBucketMount] | None = None, environment: Environment | str | None = None, proxy: Proxy | str | None = None, probes: Iterable[Probe] | None = None) -> Callable[[type], _ClsHandle]Decorator that registers a Python class as a remote class task. The class is instantiated once per container; @gw.method()-decorated methods become individually callable. Combine with @gw.concurrent or @gw.on_enter for advanced lifecycle control.