pygx.concurrent¶
Concurrent execution under PyGX's contextual overrides.
concurrent
¶
Concurrent execution under PyGX's contextual overrides.
pygx.concurrent provides building blocks for running synchronous and
asynchronous Python functions in parallel, with optional retry and progress
reporting:
with_retry/with_retry_asyncwrap a callable with bounded retries and optional exponential backoff.execute/execute_asyncapply a function to an iterable of inputs in parallel and return results in input order.maplazily yields(input, output, error)tuples with support for ordered/unordered output, per-item and overall timeouts, and a thread-safe progress bar.Job,RetryError, andRetryEntrydescribe a single unit of work and its retry history.ExecutorPool/get_executorcache thread pools keyed by resource id so global rate limits can be honored across nested calls.invoke_async/invoke_sync/iter_sync/sync_context_manageradapt between sync and async callables (built onanyioblocking portals) while propagating contextual overrides across the boundary.thread_local_*helpers manage thread-local state with optional scope-based override semantics.
Contextual overrides registered via pg.contextual.override are propagated
into worker threads using pg.contextual.with_override, so symbolic objects
that resolve pg.contextual.Placeholder fields behave consistently inside and
outside the executor.
The package uses lazy attribute resolution: public symbols are wired through
__getattr__ so that submodules like _thread_local can be imported by
foundational layers (e.g. pg.utils._formatting) without triggering the
heavier _async / _map / _retry imports that depend on pg.utils and
pg.symbolic.
options: show_root_heading: false show_root_toc_entry: false members_order: source heading_level: 2