It is a small library, which solves single task: orchestration of asynchronous applications.
For example, we have an application, which consists of database, message queue, web API, and background workers. Database and message queue are independent, they can be launched concurrently. Web API and background workers are independent too. But they both depend on database and message queue. So they should be launched after and stopped before database and message queue.
This is how it can be solved using AIOConductor.
from aioconductor import Conductor, Component
class Database(Component):
async def on_setup(self):
""" Setup database """
async def on_shutdown(self):
""" Shutdown database """
class MessageQueue(Component):
async def on_setup(self):
""" Setup message queue """
async def on_shutdown(self):
""" Shutdown message queue """
class WebAPI(Component):
db: Database # Dependencies are declared by type annotations.
queue: MessageQueue # Real instances of the components will be injected
# during setup routine.
async def on_setup(self):
""" Setup web API """
async def on_shutdown(self):
""" Shutdown web API """
class BackgroundWorkers(Component):
db: Database
queue: MessageQueue
async def on_setup(self):
""" Setup background workers """
async def on_shutdown(self):
""" Shutdown background workers """
conductor = Conductor()
conductor.add(WebAPI)
conductor.add(BackgroundWorkers)
conductor.serve()
The code above will run concurrent setup of Database and MessageQueue, and then concurrent setup of WebAPI and BackgroundWorkers. Shutdown will be run in opposite order.
Conductor also provides ability to patch component by alternative implementation. It can be useful for testing.
class MessageQueueMock(Component):
async def on_setup(self):
""" Setup message queue mock """
async def on_shutdown(self):
""" Shutdown message queue mock """
conductor = Conductor()
conductor.patch(MessageQueue, MessageQueueMock)
# An instance of ``MessageQueueMock`` will be injected into
# ``WebAPI`` and ``BackgroundWorkers``, instead of ``MessageQueue``.
conductor.add(WebAPI)
conductor.add(BackgroundWorkers)
conductor.serve()
Metadata
Release files for AIOConductor 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| AIOConductor-0.2-py36-none-any.whl | Python 3.6 | none | any | Details for AIOConductor-0.2-py36-none-any.whl |
Release files / AIOConductor-0.2-py36-none-any.whl
| Download URL | AIOConductor-0.2-py36-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3.6 |
|
SHA-256 checksum How to use checksums |
eff577c600bb3504afc254c685163ecbd5897ca4ae83a734012f9d76299b6b2b
|
|
BLAKE2b-256 checksum How to use checksums |
f3564f3297b9f0d3210ab2fd8fdb596c478c5b110aa40ba6df266f4b9fd120ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.6.14
|
Security for AIOConductor 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.