Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
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/.
Python provides two different modules, sched and concurrent.futures and it is in the hands of the user to implement the ScheduledThreadPoolExecutor. Though there are packages that provide scheduling in Python, there is no implementation as close to the one provided by Java. So, I’ve implemented the same with the APIs to closely resemble the ones in Java.
View on GitHub
Related posts
- The first release candidate of PyScaffold 4.0 just arrived!🎉
- Which scaffolding package should I use?
- Comment structurer mon projet Python ?
- Resources to learn how to make production quality code for projects? (using github, project organization, unit testing...)
- Py2wasm – A Python to WASM Compiler