about summary refs log tree commit diff
path: root/scripts/rqtl2/install_phenos.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-10-24 15:54:24 -0500
committerFrederick Muriuki Muriithi2024-10-24 15:56:41 -0500
commita52401e7191850c4a6542da1af5f2b2769312871 (patch)
tree52a9622b2f8461ef4074bd775460b22963ae10a5 /scripts/rqtl2/install_phenos.py
parent80ae9ca56a34ae11c840bd6a7d24fbd9771c0c3e (diff)
downloadgn-uploader-a52401e7191850c4a6542da1af5f2b2769312871.tar.gz
Move logger creation to `build_main` function
Since the module-level loggers are built mostly the same, move the
creation of the logger to the more general function to reduce
repetition.
Diffstat (limited to 'scripts/rqtl2/install_phenos.py')
-rw-r--r--scripts/rqtl2/install_phenos.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/scripts/rqtl2/install_phenos.py b/scripts/rqtl2/install_phenos.py
index b5cab8e..e96742f 100644
--- a/scripts/rqtl2/install_phenos.py
+++ b/scripts/rqtl2/install_phenos.py
@@ -4,7 +4,7 @@ import traceback
 from pathlib import Path
 from zipfile import ZipFile
 from functools import reduce
-from logging import Logger, getLogger, StreamHandler
+from logging import Logger, getLogger
 
 import MySQLdb as mdb
 from MySQLdb.cursors import DictCursor
@@ -18,6 +18,8 @@ from r_qtl import r_qtl2_qc as rqc
 
 from functional_tools import take
 
+__MODULE__ = "scripts.rqtl2.install_phenos"
+
 def insert_probesets(dbconn: mdb.Connection,
                      platformid: int,
                      phenos: tuple[str, ...]) -> int:
@@ -155,16 +157,5 @@ if __name__ == "__main__":
 
         return parser.parse_args()
 
-    thelogger = getLogger("install_phenos")
-    thelogger.addHandler(StreamHandler(stream=sys.stderr))
-    main = build_main(
-        cli_args(),
-        lambda dbconn, args: install_pheno_files(dbconn,
-                                                 args.speciesid,
-                                                 args.platformid,
-                                                 args.datasetid,
-                                                 args.rqtl2bundle,
-                                                 thelogger),
-        thelogger,
-        "DEBUG")
+    main = build_main(cli_args(), install_pheno_files, __MODULE__)
     sys.exit(main())