Незначительные правки
This commit is contained in:
26
src/main_example.py
Normal file
26
src/main_example.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user