aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qc_on_rqtl2_bundle.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/qc_on_rqtl2_bundle.py b/scripts/qc_on_rqtl2_bundle.py
new file mode 100644
index 0000000..5802f3a
--- /dev/null
+++ b/scripts/qc_on_rqtl2_bundle.py
@@ -0,0 +1,42 @@
+"""Run Quality Control checks on R/qtl2 bundle."""
+import sys
+from logging import getLogger, StreamHandler
+
+from redis import Redis
+
+from qc_app import jobs
+from qc_app.db_utils import database_connection
+from qc_app.check_connections import check_db, check_redis
+
+from scripts.cli_parser import init_cli_parser
+from scripts.redis_logger import setup_redis_logger
+
+def run_qc(_args):
+ """Run the QC programs."""
+ return 1
+
+if __name__ == "__main__":
+ def main():
+ """Enter R/qtl2 bundle QC runner."""
+ args = init_cli_parser(
+ "qc-on-rqtl2-bundle", "Run QC on R/qtl2 bundle.").parse_args()
+ check_redis(args.redisuri)
+ check_db(args.databaseuri)
+
+ logger = getLogger("qc-on-rqtl2-bundle")
+ logger.addHandler(StreamHandler(stream=sys.stderr))
+ logger.setLevel("DEBUG")
+
+ fqjobid = jobs.job_key(args.redisprefix, args.jobid)
+ with (database_connection(args.databaseuri) as _dbconn,
+ Redis.from_url(args.redisuri, decode_responses=True) as rconn):
+ logger.addHandler(setup_redis_logger(
+ rconn, fqjobid, f"{fqjobid}:log-messages",
+ args.redisexpiry))
+
+ exitcode = run_qc(args)
+ rconn.hset(
+ jobs.job_key(args.redisprefix, args.jobid), "exitcode", exitcode)
+ return exitcode
+
+ sys.exit(main())