Skip to content
Snippets Groups Projects
Verified Commit ea2b5738 authored by David Hoese's avatar David Hoese
Browse files

Switch to metobscommon influxdb_conn_params

parent a5a38865
No related branches found
No related tags found
No related merge requests found
......@@ -217,7 +217,7 @@ def main():
ldmp_tables=args.tables,
tail_file=args.tail,
)
influxdb_conn_params = {"host": args.host, "port": args.port, "dbname": args.dbname}
influxdb_conn_params = influxdb.convert_influxdb_args_to_kwargs(args)
try:
influx_gen = convert_to_influx_frame(record_gen, symbols, args.debug)
influx_gen = influxdb.grouper(influx_gen, args.bulk)
......@@ -233,12 +233,14 @@ def main():
except (RuntimeError, ValueError, KeyError, requests.RequestException):
if hasattr(record_gen, "close"):
record_gen.close()
raise
def _create_arg_parser():
import argparse
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
influxdb.add_influxdb_command_line_arguments(parser)
parser.add_argument("--logfn", help="Log to rotating file (Not Implemented)")
parser.add_argument(
"--debug",
......@@ -260,9 +262,6 @@ def _create_arg_parser():
help="Treat `src` file as a station name and read records from LoggerNet LDMP server (port: 1024)",
)
parser.add_argument("--tables", nargs="*", default=["1"], help="LoggerNet LDMP tables to read in")
parser.add_argument("--host", default=influxdb.DB_HOST, help="Hostname of database connection")
parser.add_argument("--port", default=influxdb.DB_PORT, help="Port of database connection")
parser.add_argument("--dbname", default=influxdb.DB_NAME, help="Name of database to modify")
parser.add_argument(
"-s",
"--station",
......@@ -328,7 +327,7 @@ def _ingest_loggernet_to_influxdb_and_weatherunderground(
for record in influx_gen:
if not debug:
lines = influxdb.frame_records(record, **station_tags)
influxdb.insert(lines, **influxdb_conn_params)
influxdb.insert(lines, influxdb_conn_params)
if not debug and not wu_pw:
# we don't plan on doing anything with averaged weatherunderground uploads
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment