This file contains hidden or 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 gist shows how to run asyncio loop in a separate thread. | |
| It could be useful if you want to mix sync and async code together. | |
| Python 3.7+ | |
| """ | |
| import asyncio | |
| from datetime import datetime | |
| from threading import Thread | |
| from typing import Tuple, List, Iterable |
This file contains hidden or 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
| sudo apt-get update && sudo apt-get install sox libsox-fmt-all |
This file contains hidden or 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
| import asyncio | |
| from collections import deque | |
| class AsyncioPool: | |
| def __init__(self, concurrency, loop=None): | |
| """ | |
| @param loop: asyncio loop | |
| @param concurrency: Maximum number of concurrently running tasks | |
| """ |
This file contains hidden or 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
| import asyncio | |
| from asyncio.queues import Queue | |
| TERMINATOR = object() | |
| class TaskPool(object): | |
| def __init__(self, loop, num_workers): | |
| self.loop = loop | |
| self.tasks = Queue(loop=self.loop) |
This file contains hidden or 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
| [DEFAULT] | |
| ; Operation mode | |
| ; This is a global value for all sections | |
| mode = master | |
| [server] | |
| ; Connection lifetime | |
| timeout = 3600 |
This file contains hidden or 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
| /var/log/supervisor/*.log { | |
| weekly | |
| rotate 52 | |
| compress | |
| delaycompress | |
| notifempty | |
| missingok | |
| copytruncate | |
| } |
NewerOlder