/scheduled_thread_pool_executor

Scheduled Thread Pool Executor implementation in python

Primary LanguagePythonMIT LicenseMIT

Project generated with PyScaffold PyPI-Server

Scheduled Thread Pool Executor

Scheduled Thread Pool Executor implementation in python

Makes use of delayed queue implementation to submit tasks to the thread pool.

Usage

from scheduled_thread_pool_executor import ScheduledThreadPoolExecutor
scheduled_executor = ScheduledThreadPoolExecutor(max_workers=5)
scheduled_executor.schedule(task, 0)  # equals to schedule once, where task is a callable
scheduled_executor.schedule_at_fixed_rate(task, 0, 5)  # schedule immediately and run periodically for every 5 secs
scheduled_executor.schedule_at_fixed_delay(task, 5, 10)  # schedule after 5secs (initial delay) and run periodically for every 10secs

Note

This project has been set up using PyScaffold 4.1.1. For details and usage information on PyScaffold see https://pyscaffold.org/.