Skip to content

Commit be84164

Browse files
committed
first version of prober
1 parent 81e5bc8 commit be84164

File tree

9 files changed

+31
-12
lines changed

9 files changed

+31
-12
lines changed

cmd/prober/probes/__init__.py

Whitespace-only changes.
File renamed without changes.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22

3-
43
def initialize_logger(name=__name__, level=logging.INFO):
54
"""
65
Initializes and configures a logger.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from cmd.prober.logging_config import initialize_logger
2-
from cmd.prober.registry import prober_function
3-
1+
from probes.logging_config import initialize_logger
2+
from probes.registry import prober_function
43
import snowflake.connector
54

65
# Initialize logger
@@ -30,6 +29,7 @@ def connect(connection_parameters):
3029
schema=connection_parameters.get("schema"),
3130
role=connection_parameters.get("role"),
3231
authenticator="KEY_PAIR_AUTHENTICATOR",
32+
private_key=connection_parameters.get("private_key"),
3333
)
3434
return connection
3535
except Exception as e:
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
import argparse
22
import logging
3-
from cmd.prober.logging_config import initialize_logger
4-
5-
from .registry import PROBES_FUNCTIONS
3+
from probes.logging_config import initialize_logger
4+
from probes.registry import PROBES_FUNCTIONS
5+
import probes.login
66

77
# Initialize logger
88
logger = initialize_logger(__name__)
99

10-
11-
if __name__ == "__main__":
10+
def main():
11+
logger.info("Starting Python Driver Prober...")
1212
# Set up argument parser
1313
parser = argparse.ArgumentParser(description="Python Driver Prober")
1414
parser.add_argument("--scope", required=True, help="Scope of probing")
15-
1615
parser.add_argument("--host", required=True, help="Host")
1716
parser.add_argument("--port", type=int, required=True, help="Port")
1817
parser.add_argument("--role", required=True, help="Protocol")
1918
parser.add_argument("--account", required=True, help="Account")
2019
parser.add_argument("--schema", required=True, help="Schema")
2120
parser.add_argument("--warehouse", required=True, help="Warehouse")
2221
parser.add_argument("--user", required=True, help="Username")
23-
parser.add_argument("--password", required=True, help="Password")
22+
parser.add_argument("--private_key", required=True, help="Private key")
2423

2524
# Parse arguments
2625
args = parser.parse_args()
@@ -33,12 +32,17 @@
3332
"schema": args.schema,
3433
"warehouse": args.warehouse,
3534
"user": args.user,
36-
"password": args.password,
35+
"private_key": args.private_key,
3736
}
3837

3938
for function_name, function in PROBES_FUNCTIONS.items():
4039
try:
40+
logging.info("BBB")
4141
logging.error(f"Running probe: {function_name}")
4242
function(connection_params)
4343
except Exception as e:
4444
logging.error(f"Error running probe {function_name}: {e}")
45+
46+
47+
if __name__ == "__main__":
48+
main()

prober/setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="snowflake_prober",
5+
version="1.0.0",
6+
packages=find_packages(),
7+
install_requires=[
8+
"snowflake-connector-python",
9+
"requests",
10+
],
11+
entry_points={
12+
"console_scripts": [
13+
"prober=probes.main:main",
14+
],
15+
},
16+
)

0 commit comments

Comments
 (0)