diff options
author | Frederick Muriuki Muriithi | 2024-02-08 15:54:32 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-02-12 18:17:38 +0300 |
commit | d02cef83c3c0b3f3098df1a7e7eeaf90430f784a (patch) | |
tree | 3a1956c48be9652ad69ceed249c3c344d91fe1b8 /scripts | |
parent | 3334120a07d8cc7d9ba2e1f23344df4d9c9c33bb (diff) | |
download | gn-uploader-d02cef83c3c0b3f3098df1a7e7eeaf90430f784a.tar.gz |
R/qtl2 QC: Set up scaffolding for QC UI
Set up the scaffolding for the flows and UI that will be used when
running QC against the uploaded R/qtl2 bundle.
This will be fleshed out later, and the UI is likely to change
somewhat, down the line.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qc_on_rqtl2_bundle.py | 42 |
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()) |