Audit events table

Audit events table#

This page details all events raised by this library through sys.audit() and the corresponding arguments.

This module takes care not to expose sensitive information in the events, so that the audit hooks often only see the fully qualified name of the type of some handled object rather than the object itself.

For consistency and namespace integrity, all audit event names begin with ‘asyncutils’, and are often exactly the fully qualified name of the function being called.

See the official documentation for sys.audit() and sys.addaudithook() on how to listen to these events, as well as channels.EventBus, which is capable of triggering mass publications to async subscribers for audit events efficiently.

Also see the standard library audit event table, from which the inclustion and format of this table take inspiration.

Audit events#

Audit event

Arguments

Description

asyncutils/create_executor

fname: str

Raised when asyncutils creates an executor, type dictated by configuration. fname is of the form ‘submodule.function’.

asyncutils/get_loop_and_set

loop: BaseEventLoop

Raised when asyncutils retrieves an event loop loop, creating one if necessary, and sets it as the event loop for the current thread if not already set.

asyncutils/recurse_configs

cwd: Path

Raised when the environment variable pointing to a config file is not set, and library resorts to beginning traversing the parents of the current working directory sequentially to look for pyproject.toml files with a (possibly empty) [tool.asyncutils] section.

asyncutils/try_config

level: int

Raised when asyncutils finds a file named pyproject.toml in the level-th parent of the current working directory (but hasn’t parsed it yet).

asyncutils/read_config

cfg_path: str

Raised when asyncutils reads its configuration file expected to be in json format at cfg_path (not guaranteed to be absolute).

asyncutils/discontinue_config

cfg_path: str

Raised when asyncutils no longer uses the configuration file at cfg_path, since its next_config key corresponds to null or equivalent.

asyncutils/set_next_config

old_path: str, new_path: str

Raised when asyncutils changes its configuration file from that at old_path to that at new_path, as dictated by the next_config field.

asyncutils.altlocks.UniqueResourceGuard

rtyp: str

Raised when UniqueResourceGuard is instantiated, with rtyp being the fully qualified name of the type of the resource being guarded, including its module.

asyncutils.altlocks.CircuitBreaker

name: str, max_fails: int

Raised when CircuitBreaker is instantiated, with name being its name and max_fails the number of consecutive failures that will cause the circuit to open.

asyncutils.altlocks.CircuitBreaker.__call__

name: str, fname: str

Raised when a CircuitBreaker of name name is applied on a function with name fname.

asyncutils.base.safe_cancel_batch

ityp: str

Raised when safe_cancel_batch() is called on the (possibly async) iterable with exact type of name ityp.

asyncutils.base.iter_to_agen

tname: str

Raised when iter_to_agen() is called on an iterable of type with name tname.

asyncutils.base.aiter_to_gen

tname: str

Raised when aiter_to_gen() is called on an async iterable of type with name tname.

asyncutils.buckets.TokenBucket

rate: float, capacity: float

Raised when TokenBucket is instantiated, with rate being the token refill rate and capacity the maximum number of tokens.

asyncutils.buckets.LeakyBucket

capacity: float, leak: float

Raised when LeakyBucket is instantiated, with capacity being the maximum number of tokens and leak the leak rate.

asyncutils.caches.CacheWithBackgroundRefresh

ttl: float, refresh: float

Raised when CacheWithBackgroundRefresh is instantiated, with ttl being the time to live of cache entries and refresh the time before expiry at which background refreshes are triggered.

asyncutils.caches.AsyncLRUCache

maxsize: int, ttl: float|None

Raised when AsyncLRUCache is instantiated, with maxsize being the maximum number of entries and ttl their time to live.

asyncutils.channels.Observable

maxsize: int|None

Raised when Observable is instantiated, with maxsize being the maximum number of subscribers or None if there is no such limit.

asyncutils.channels.EventBus

name: str

Raised when EventBus is instantiated, with name being its name or None if not passed.

asyncutils.channels.EventBus.start_audit

addr: int

Raised when the start_audit() method of EventBus is called, with the memory address of the instance as argument.

asyncutils.channels.EventBus.stop_audit

addr: int

Raised when the stop_audit() method of EventBus is called, with the memory address of the instance as argument.

asyncutils.channels.EventBus.event_stream

addr: int, event_type: str|None

Raised when the event_stream() method of EventBus is called. addr is the memory address of the instance, and event_type is the event type the stream was opened for or None for catch-all streams.

asyncutils.cli.run

Raised with no arguments when the command-line interface of this library is first invoked through the entry point asyncutils, even if just asking for the version or help.

asyncutils.compete.first_completed/start

ntasks: int

Raised when first_completed() is called, with ntasks coroutines.

asyncutils.compete.first_completed/end

ntasks: int

Raised when first_completed() finishes, with ntasks coroutines.

asyncutils.compete.race_with_callback/start

ntasks: int

Raised when race_with_callback() is called, with ntasks coroutines.

asyncutils.compete.race_with_callback/end

ntasks: int

Raised when race_with_callback() finishes, with ntasks coroutines.

asyncutils.compete.multi_winner_race_with_callback/start

ntasks: int

Raised when multi_winner_race_with_callback() is called, with ntasks coroutines.

asyncutils.compete.multi_winner_race_with_callback/end

ntasks: int

Raised when multi_winner_race_with_callback() finishes, with ntasks coroutines.

asyncutils.console.AsyncUtilsConsole.run

addr: int

Raised when the run() method of an instance of asyncutils.console.AsyncUtilsConsole at addr is called.

asyncutils.exceptions.unnest

n: int

Raised when unnest() is called, with n being a sloppy lower bound on the number of exception( group)s.

asyncutils.exceptions.unnest_reverse

n: int

Raised when unnest_reverse() is called, with n being a sloppy lower bound on the number of exception( group)s.

asyncutils.exceptions.raise_exc

exc: BaseException

Raised when raise_exc() is about to raise exc, such that hooks may process the instance or perform validation outside the scope of prepare_exception().

asyncutils.func.benchmark

fname: str, total_rounds: int

Raised when benchmark() is called, with fname being the name of the function being benchmarked, and total_rounds the total number of rounds to be executed, including warmup rounds.

asyncutils.func.RateLimited

fname: str, calls: int, period: float

Raised when a RateLimited is instantiated, with fname being the name of the function being rate limited, calls the number of calls allowed every period seconds.

asyncutils.futures.AsyncCallbacksFuture/schedule_callbacks

addr: int

Raised when the exact instance of AsyncCallbacksFuture at address addr schedules its sync and async callbacks.

asyncutils.futures.AsyncCallbacksTask/schedule_callbacks

addr: int

The above, but for exact instances of AsyncCallbacksTask.

asyncutils.futures.EagerAsyncCallbacksFuture/schedule_callbacks

addr: int

The above, but for exact instances of EagerAsyncCallbacksFuture.

asyncutils.futures.EagerAsyncCallbacksTask/schedule_callbacks

addr: int

The above, but for exact instances of EagerAsyncCallbacksTask.

asyncutils.io.double_ended_pipe

reader1: int, writer1: int, reader2: int, writer2: int

Raised when double_ended_text_pipe() or double_ended_binary_pipe() is called, with the file descriptors of the reader and writer ends of both pipes as arguments.

asyncutils.iterclasses.online_sorter

Raised when online_sorter is instantiated.

asyncutils.iters.agetitems_from_indices

tname: str

Raised when agetitems_from_indices() is called on an iterable, the type of which has full name tname.

asyncutils.iters.aintersend

tname1: str, tname2: str

Raised when aintersend() is called on two async generators, the types of which have full names tname1 and tname2 respectively.

asyncutils.iters.asendstream

tname1: str, tname2: str

Raised when asendstream() is called, the full name of the type of the async generator being tname1 and that of the (async) iterable being tname2.

asyncutils.iters.acat

first: Any

Raised when acat() is called, first being the item yielded to start the async generator.

asyncutils.iters.aforever

Raised when aforever() is called.

asyncutils.networking.LineProtocol

Raised when LineProtocol is instantiated.

asyncutils.networking.CRLFProtocol

Raised when CRLFProtocol is instantiated.

asyncutils.networking.CRProtocol

Raised when CRProtocol is instantiated.

asyncutils.networking.LFProtocol

Raised when LFProtocol is instantiated.

asyncutils.networking.SocketTransport

Raised when SocketTransport is instantiated.

asyncutils.queues.password_queue

get_from: str|None, put_from: str|None

Raised when password_queue() is called, with the names of the variables from which passwords for get and put operations will be retrieved in the caller scope if they are protected, or None if they are not protected. Of course, the audit hooks do not see the passwords themselves.

asyncutils.queues.SmartQueue.push

addr: int, pushed: T, popped: T

Raised when the push() method of an exact instance of SmartQueue[T] is called and the queue is full, such that an item must be popped, to avoid data loss. addr is the memory address of the instance, pushed the item being pushed, and popped the item being popped.

asyncutils.queues.SmartQueue.transaction/start

addr: int

Raised when the transaction() method of an exact instance of SmartQueue is called, with addr being the memory address of the instance.

asyncutils.queues.SmartQueue.transaction/end

addr: int

Raised when the context manager returned by the transaction() method of an exact instance of SmartQueue exits (the transaction succeeds or fails), with addr being the memory address of the instance.

asyncutils.queues.SmartQueue.map

addr: int, fname: str

Raised when the map() method of an exact instance of SmartQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartQueue.starmap

addr: int, fname: str

Raised when the starmap() method of an exact instance of SmartQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartQueue.filter

addr: int, fname: str

Raised when the filter() method of an exact instance of SmartQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the predicate.

asyncutils.queues.SmartQueue.enumerate

addr: int

Raised when the enumerate() method of an exact instance of SmartQueue is called, with addr being the memory address of the instance.

asyncutils.queues.SmartLifoQueue.push

addr: int, pushed: T, popped: T

Raised when the push() method of an exact instance of SmartLifoQueue[T] is called and the queue is full, such that an item must be popped, to avoid data loss. addr is the memory address of the instance, pushed the item being pushed, and popped the item being popped.

asyncutils.queues.SmartLifoQueue.transaction/start

addr: int

Raised when the transaction() method of an exact instance of SmartLifoQueue is called, with addr being the memory address of the instance.

asyncutils.queues.SmartLifoQueue.transaction/end

addr: int

Raised when the context manager returned by the transaction() method of an exact instance of SmartLifoQueue exits (the transaction succeeds or fails), with addr being the memory address of the instance.

asyncutils.queues.SmartLifoQueue.map

addr: int, fname: str

Raised when the map() method of an exact instance of SmartLifoQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartLifoQueue.starmap

addr: int, fname: str

Raised when the starmap() method of an exact instance of SmartLifoQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartLifoQueue.filter

addr: int, fname: str

Raised when the filter() method of an exact instance of SmartLifoQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the predicate.

asyncutils.queues.SmartLifoQueue.enumerate

addr: int

Raised when the enumerate() method of an exact instance of SmartLifoQueue is called, with addr being the memory address of the instance.

asyncutils.queues.SmartPriorityQueue.push

addr: int, pushed: T, popped: T

Raised when the push() method of an exact instance of SmartPriorityQueue[T] is called and the queue is full, such that an item must be popped, to avoid data loss. addr is the memory address of the instance, pushed the item being pushed, and popped the item being popped.

asyncutils.queues.SmartPriorityQueue.transaction/start

addr: int

Raised when the transaction() method of an exact instance of SmartPriorityQueue is called, with addr being the memory address of the instance.

asyncutils.queues.SmartPriorityQueue.transaction/end

addr: int

Raised when the context manager returned by the transaction() method of an exact instance of SmartPriorityQueue exits (the transaction succeeds or fails), with addr being the memory address of the instance.

asyncutils.queues.SmartPriorityQueue.map

addr: int, fname: str

Raised when the map() method of an exact instance of SmartPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartPriorityQueue.starmap

addr: int, fname: str

Raised when the starmap() method of an exact instance of SmartPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.SmartPriorityQueue.filter

addr: int, fname: str

Raised when the filter() method of an exact instance of SmartPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the predicate.

asyncutils.queues.SmartPriorityQueue.enumerate

addr: int

Raised when the enumerate() method of an exact instance of SmartPriorityQueue is called, with addr being the memory address of the instance.

asyncutils.queues.UserPriorityQueue.push

addr: int, pushed: T, popped: T

Raised when the push() method of an exact instance of UserPriorityQueue[T] is called and the queue is full, such that an item must be popped, to avoid data loss.

asyncutils.queues.UserPriorityQueue.transaction/start

addr: int

Raised when the transaction() method of an exact instance of UserPriorityQueue is called, with addr being the memory address of the instance.

asyncutils.queues.UserPriorityQueue.transaction/end

addr: int

Raised when the context manager returned by the transaction() method of an exact instance of UserPriorityQueue exits (the transaction succeeds or fails), with addr being the memory address of the instance.

asyncutils.queues.UserPriorityQueue.map

addr: int, fname: str

Raised when the map() method of an exact instance of UserPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.UserPriorityQueue.starmap

addr: int, fname: str

Raised when the starmap() method of an exact instance of UserPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the transformation function.

asyncutils.queues.UserPriorityQueue.filter

addr: int, fname: str

Raised when the filter() method of an exact instance of UserPriorityQueue is called, with addr being the memory address of the instance and fname the fully qualified name of the predicate.

asyncutils.queues.UserPriorityQueue.enumerate

addr: int

Raised when the enumerate() method of an exact instance of UserPriorityQueue is called, with addr being the memory address of the instance.

asyncutils.signals.wait_for_signal

sigs: set[int]

Raised when wait_for_signal() is called on signal numbers sigs. Audit hooks can modify the set, and the changes will be reflected.

asyncutils.util.sync_await

atname: str

Raised when sync_await() is called on an awaitable whose type is of name atname.

asyncutils.util.to_async

fname: str

Raised when to_async() is called on a function with name fname.

asyncutils.util.to_sync

fname: str

Raised when to_sync() is called on a function with name fname.