From f8e532d017627333d87f52941f1bc5a68e6dc3ed Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Thu, 8 Aug 2024 18:34:27 +0200 Subject: [PATCH] healthcheck --- .vscode/settings.json | 2 +- anaxi/cli.py | 10 ++++++++++ anaxi/processes.py | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 anaxi/processes.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 2298517..ca89d2b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,5 @@ ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, - "python.analysis.typeCheckingMode": "basic", + "python.analysis.typeCheckingMode": "off", } \ No newline at end of file diff --git a/anaxi/cli.py b/anaxi/cli.py index 00ddcf1..542c038 100644 --- a/anaxi/cli.py +++ b/anaxi/cli.py @@ -4,6 +4,8 @@ import logging import click import pyfiglet +from anaxi.processes import run_cosmos_db_healthcheck_process + logging.basicConfig( level=logging.DEBUG, format="%(asctime)s - [%(levelname)s] - %(filename)s - L%(lineno)d - %(message)s", @@ -32,3 +34,11 @@ def smoke_test(): |__,'`-..--|__|--'' """ ) + + +@cli.command() +@click.option("--cosmos-db-id", type=click.STRING) +def cosmos_db_healthcheck(cosmos_db_id): + logger.info("Starting a Cosmos DB healthcheck.") + run_cosmos_db_healthcheck_process(cosmos_db_id) + logger.info("Finished the Cosmos DB healthcheck.") diff --git a/anaxi/processes.py b/anaxi/processes.py new file mode 100644 index 0000000..854ef52 --- /dev/null +++ b/anaxi/processes.py @@ -0,0 +1,10 @@ +import logging + +logger = logging.getLogger() + + +def run_cosmos_db_healthcheck_process(cosmos_db_id: str) -> None: + + logger.info( + f"If I had a cosmos db connector, I would really try to hit this database: {cosmos_db_id}" + )