-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
367 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,3 +115,5 @@ ENV/ | |
*.swo | ||
|
||
pyrightconfig.json | ||
|
||
logs/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# @Author: José Sánchez-Gallego (gallegoj@uw.edu) | ||
# @Date: 2024-07-25 | ||
# @Filename: broker.py | ||
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) | ||
|
||
from __future__ import annotations | ||
|
||
from taskiq_aio_pika import AioPikaBroker | ||
from taskiq_redis import RedisAsyncResultBackend | ||
|
||
|
||
__all__ = ["broker"] | ||
|
||
|
||
async def broker_startup(): | ||
"""Start broker on startup.""" | ||
|
||
if not broker.is_worker_process: | ||
await broker.startup() | ||
|
||
|
||
async def broker_shutdown(): | ||
"""Shut down broker.""" | ||
|
||
if not broker.is_worker_process: | ||
await broker.shutdown() | ||
|
||
|
||
# TaskIQ broker. | ||
backend = RedisAsyncResultBackend("redis://localhost") | ||
broker = AioPikaBroker().with_result_backend(backend) |
Oops, something went wrong.