tessl install tessl/github-python--cpython@3.13.0CPython is the reference implementation of the Python programming language providing the core interpreter, runtime system, and comprehensive standard library.
Agent Success
Agent success rate when using this tile
96%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.07x
Baseline
Agent success rate without this tile
90%
Coordinate asynchronous jobs with bounded concurrency, per-job timeouts, and clean loop management so that workloads can be triggered from both async and synchronous entrypoints.
@generates
from dataclasses import dataclass
from typing import Awaitable, Callable, Generic, Iterable, List, Optional, TypeVar
T = TypeVar("T")
@dataclass
class Job(Generic[T]):
name: str
coroutine_factory: Callable[[], Awaitable[T]]
protected: bool = False # run-to-completion even when a stop is requested
@dataclass
class JobResult(Generic[T]):
name: str
status: str # "ok" | "timeout" | "cancelled" | "error"
value: Optional[T] = None
error: Optional[BaseException] = None
async def orchestrate_jobs(
jobs: Iterable[Job[T]],
max_concurrency: int,
per_job_timeout: float,
stop_signal: Optional[Awaitable[object]] = None
) -> List[JobResult[T]]:
"""
Schedule jobs with bounded concurrency and per-job timeouts.
Returns results in submission order while respecting stop requests.
"""
def run_sync(
jobs: Iterable[Job[T]],
max_concurrency: int,
per_job_timeout: float,
stop_after: Optional[float] = None
) -> List[JobResult[T]]:
"""
Synchronous entrypoint that spins up and tears down an event loop
to run orchestrate_jobs, respecting optional stop-after seconds.
"""Provides asynchronous event loop, task orchestration, and timing primitives.