You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add configurable event loop factories to worker and scheduler CLI #659
TaskIQ creates event loops internally in both CLI execution paths:
worker subprocesses call asyncio.new_event_loop()
the scheduler calls asyncio.run()
Applications that require a specific event loop implementation cannot provide one. One example is async Psycopg on Windows, which cannot run on the default ProactorEventLoop and requires a selector-based loop.
A process-wide event loop policy can currently work around this, but asyncio policies are deprecated in Python 3.14 and scheduled for removal in Python 3.16. Hardcoding WindowsSelectorEventLoopPolicy, as proposed in #641, would therefore solve only the worker case and depend on an API that is already being removed.
Describe the solution you'd like
Add an optional --loop-factory module:callable option to both taskiq worker and taskiq scheduler.
The imported callable should return an asyncio.AbstractEventLoop.
For workers, the factory should be resolved inside each worker subprocess and take precedence over automatic uvloop selection. For the scheduler, it should be passed to the scheduler runner. Existing behavior should remain unchanged when the option is omitted.
Setting a process-wide asyncio event loop policy. This is deprecated in Python 3.14 and scheduled for removal in Python 3.16.
Automatically forcing a selector policy on Windows. This changes the default globally, covers only one platform, and still relies on the deprecated policy API.
Reimplementing TaskIQ's worker or scheduler launchers in application code. This duplicates TaskIQ's process supervision and CLI behavior.
Activity