Client.runner
python
def Client.runner(
cluster: ClusterSlugLike | None = None,
tasks: list[type[Task]] | None = None,
cache: JobCache | None = None,
context: type[RunnerContext] | None = None,
runner: Runner | None = None,
) -> TaskRunnerInitialize a direct runner from task classes.
For new Python workflow projects, define a reusable Runner object and call Runner.connect_to when you want direct execution. The Client.runner method remains available for existing code and simple direct runner scripts.
Parameters
cluster str | None The cluster slug for the cluster associated with this direct runner. If not provided, the default cluster is used.
tasks list[type[Task]] | None A list of task classes that this runner can execute. Pass either tasks, cache, and context, or pass a reusable runner object.
cache JobCache An optional job cache for caching results from tasks and sharing data between tasks.
context type[RunnerContext] | None Optional runner context class to instantiate for task execution.
runner Runner | None A reusable runner definition. If provided, do not also pass tasks, cache, or context.