27 lines
589 B
Python
27 lines
589 B
Python
import os
|
|
os.chdir(os.path.dirname(__file__))
|
|
|
|
import logging
|
|
import asyncio
|
|
|
|
from config_manager.config_manager import ConfigManager
|
|
logger = logging.getLogger()
|
|
|
|
# Пример наследования и переопределения execute
|
|
class MyApp(ConfigManager):
|
|
def execute(self) -> None:
|
|
logger.info("Executing blocking work with config: %s", self.config)
|
|
|
|
|
|
async def main():
|
|
app = MyApp("config.yaml")
|
|
app.start()
|
|
await asyncio.sleep(20)
|
|
await app.stop()
|
|
logger.info("Work finished.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|