Utilities

Warning

External usage of internal utility functions and modules should be kept to a minimum as they may be altered, refactored or moved to other locations without notice (and without the typical deprecation cycle).

Async

Deprecation

Eventlet

Kazoo

Kombu

class taskflow.utils.kombu_utils.DelayedPretty(message)[source]

Bases: object

Wraps a message and delays prettifying it until requested.

Locks

Miscellaneous

Persistence

Threading

taskflow.utils.threading_utils.is_alive(thread)[source]

Helper to determine if a thread is alive (handles none safely).

taskflow.utils.threading_utils.get_ident()[source]

Return the ‘thread identifier’ of the current thread.

taskflow.utils.threading_utils.get_optimal_thread_count()[source]

Try to guess optimal thread count for current system.

taskflow.utils.threading_utils.daemon_thread(target, *args, **kwargs)[source]

Makes a daemon thread that calls the given target when started.

class taskflow.utils.threading_utils.ThreadBundle[source]

Bases: object

A group/bundle of threads that start/stop together.

bind(thread_factory, before_start=None, after_start=None, before_join=None, after_join=None)[source]

Adds a thread (to-be) into this bundle (with given callbacks).

NOTE(harlowja): callbacks provided should not attempt to call
mutating methods (stop(), start(), bind() ...) on this object as that will result in dead-lock since the lock on this object is not meant to be (and is not) reentrant...
start()[source]

Creates & starts all associated threads (that are not running).

stop()[source]

Stops & joins all associated threads (that have been started).

Table Of Contents

Navigation

This Page