kwcoco.util.util_kwutil module

This is a staging ground for utilities that may make there way into kwutil proper at some point in the future.

class kwcoco.util.util_kwutil._DelayedFuture(func, args, kwargs, parent)[source]

Bases: object

todo: move to kwutil

Wraps a future object so we can execute logic when its result has been accessed.

result(timeout=None)[source]
class kwcoco.util.util_kwutil._DelayedBlockingJobQueue(max_unhandled_jobs, mode='thread', max_workers=None)[source]

Bases: object

todo: move to kwutil

References

submit(func, *args, **kwargs)[source]

Queues a new job, but wont execute until some conditions are met

_submit_if_room()[source]
_job_result_accessed_callback(_)[source]

Called when the user handles a result

shutdown()[source]

Calls the shutdown function of the underlying backend.

class kwcoco.util.util_kwutil._MaxQueuePool(max_queue_size=None, mode='thread', max_workers=0)[source]

Bases: object

todo: move to kwutil

This Class wraps a concurrent.futures.Executor limiting the size of its task queue. If max_queue_size tasks are submitted, the next call to submit will block until a previously submitted one is completed.

References

submit(function, *args, **kwargs)[source]

Submits a new task to the pool, blocks if Pool queue is full.

pool_queue_callback(_)[source]

Called once task is done, releases one queue slot.

shutdown()[source]

Calls the shutdown function of the underlying backend.