This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
4 changed files
with
806 additions
and
816 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 |
---|---|---|
@@ -1,33 +1,23 @@ | ||
import asyncio | ||
import logging | ||
import os | ||
import traceback | ||
from pathlib import Path | ||
|
||
from odd_collector_sdk.collector import Collector | ||
from odd_collector_sdk.logger import logger | ||
|
||
from odd_collector_aws.domain.plugin import PLUGIN_FACTORY | ||
|
||
logging.basicConfig( | ||
level=os.getenv("LOGLEVEL", "INFO"), | ||
format="[%(asctime)s] %(levelname)s in %(name)s: %(message)s", | ||
) | ||
logger = logging.getLogger("odd-collector-aws") | ||
from .version import print_version | ||
|
||
if __name__ == "__main__": | ||
try: | ||
loop = asyncio.get_event_loop() | ||
|
||
config_path = Path().cwd() / os.getenv("CONFIG_PATH", "collector_config.yaml") | ||
|
||
root_package = "odd_collector_aws.adapters" | ||
|
||
collector = Collector(str(config_path), root_package, PLUGIN_FACTORY) | ||
print_version() | ||
|
||
loop.run_until_complete(collector.register_data_sources()) | ||
|
||
collector.start_polling() | ||
|
||
asyncio.get_event_loop().run_forever() | ||
try: | ||
collector = Collector( | ||
config_path=Path().cwd() / "collector_config.yaml", | ||
root_package="odd_collector_aws.adapters", | ||
plugin_factory=PLUGIN_FACTORY, | ||
) | ||
collector.run() | ||
except Exception as e: | ||
logger.exception(e) | ||
asyncio.get_event_loop().stop() | ||
logger.debug(traceback.format_exc()) | ||
logger.error(e) |
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,12 @@ | ||
from odd_collector_sdk.logger import logger | ||
|
||
|
||
def print_version(): | ||
import subprocess | ||
|
||
try: | ||
logger.info( | ||
subprocess.run(["poetry", "version"], capture_output=True).stdout.decode() | ||
) | ||
except Exception as e: | ||
logger.error("Couldn't show version. {e}") |
Oops, something went wrong.