class documentation

Run functions in a bounded set of daemon threads.

asyncio requires a ThreadPoolExecutor as its default executor. This class provides that interface and creates daemon workers lazily as work is submitted, up to the configured maximum.

Method __enter__ Return this executor for use as a context manager.
Method __exit__ Stop the executor when its context exits.
Method __init__ Initialize the executor without eagerly starting workers.
Method owns_thread Return whether this executor owns thread.
Method shutdown Stop the executor.
Method submit Submit a function call to the worker queue.
Method _worker Run queued work until the queue contains a stop marker.
Instance Variable _shutdown Undocumented
Instance Variable _threads Undocumented
Instance Variable _work_queue Undocumented

Return this executor for use as a context manager.

def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None): (source)

Stop the executor when its context exits.

def __init__(self, max_workers: int, thread_name_prefix: str = 'nebius-sdk'): (source)

Initialize the executor without eagerly starting workers.

Parameters
max_workers:intNumber of worker threads.
thread_name_prefix:strPrefix for each worker thread name.
Raises
ValueErrorIf max_workers is not positive.
def owns_thread(self, thread: Thread) -> bool: (source)

Return whether this executor owns thread.

Parameters
thread:ThreadThread to examine.
Returns
boolTrue if thread is an executor worker.
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False): (source)

Stop the executor.

This method does not interrupt a function that is already running.

Parameters
wait:boolWait for worker threads to stop when this value is True.
cancel_futures:boolCancel queued work that has not started when this value is True.
def submit(self, fn: Callable[..., T], /, *args: Any, **kwargs: Any) -> Future[T]: (source)

Submit a function call to the worker queue.

Parameters
fn:Callable[..., T]Function to call.
*args:AnyPositional arguments for fn.
**kwargs:AnyKeyword arguments for fn.
Returns
Future[T]Future that receives the call result.
Raises
RuntimeErrorIf executor shutdown has started.
def _worker(self): (source)

Run queued work until the queue contains a stop marker.

_shutdown: bool = (source)

Undocumented

Undocumented

Undocumented