diff options
author | Frederick Muriuki Muriithi | 2023-10-16 14:41:39 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-10-16 14:41:39 +0300 |
commit | c9af16ce37ccfbf75183ed0214e3a52a9d91dcc7 (patch) | |
tree | 1f6e2ae055e40fe326883cb120dc9788c2673e39 /qc_app/dbinsert.py | |
parent | 0d5dc5489837957e3fab513b9dcc550eddfe53ca (diff) | |
download | gn-uploader-c9af16ce37ccfbf75183ed0214e3a52a9d91dcc7.tar.gz |
Indicate progress for data insert.
Diffstat (limited to 'qc_app/dbinsert.py')
-rw-r--r-- | qc_app/dbinsert.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py index 32043a7..e9dc3ff 100644 --- a/qc_app/dbinsert.py +++ b/qc_app/dbinsert.py @@ -134,8 +134,9 @@ def select_platform(): gchips = genechips() return render_template( "select_platform.html", filename=filename, - filetype=job["filetype"], default_species=default_species, - species=species(), genechips=gchips[default_species], + filetype=job["filetype"], totallines=int(job["currentline"]), + default_species=default_species, species=species(), + genechips=gchips[default_species], genechips_data=json.dumps(gchips)) return render_error(f"File '{filename}' no longer exists.") return render_error(f"Job '{job_id}' no longer exists.") @@ -159,8 +160,9 @@ def select_study(): organise_groups_by_family, groups_by_species(speciesid), {}) return render_template( "select_study.html", filename=form["filename"], - filetype=form["filetype"], species=speciesid, genechipid=genechipid, - studies=the_studies, groups=the_groups, tissues = tissues(), + filetype=form["filetype"], totallines=form["totallines"], + species=speciesid, genechipid=genechipid, studies=the_studies, + groups=the_groups, tissues = tissues(), selected_group=int(form.get("inbredsetid", -13)), selected_tissue=int(form.get("tissueid", -13))) except AssertionError as aserr: @@ -198,8 +200,8 @@ def create_study(): return render_template( "continue_from_create_study.html", filename=form["filename"], filetype=form["filetype"], - species=form["species"], genechipid=form["genechipid"], - studyid=new_studyid) + totallines=form["totallines"], species=form["species"], + genechipid=form["genechipid"], studyid=new_studyid) except AssertionError as aserr: flash(f"Missing data: {aserr.args[0]}", "alert-error") return redirect(url_for("dbinsert.select_study"), code=307) @@ -252,9 +254,10 @@ def select_dataset(): datasets = datasets_by_study(studyid) return render_template( "select_dataset.html", filename=form["filename"], - filetype=form["filetype"], species=form["species"], - genechipid=form["genechipid"], studyid=studyid, datasets=datasets, - avgmethods=averaging_methods(), datascales=dataset_datascales()) + filetype=form["filetype"], totallines=form["totallines"], + species=form["species"], genechipid=form["genechipid"], + studyid=studyid, datasets=datasets, avgmethods=averaging_methods(), + datascales=dataset_datascales()) except AssertionError as aserr: return render_error(f"Missing data: {aserr.args[0]}") @@ -295,7 +298,8 @@ def create_dataset(): "continue_from_create_dataset.html", filename=form["filename"], filetype=form["filetype"], species=form["species"], genechipid=form["genechipid"], - studyid=form["studyid"], datasetid=new_datasetid) + studyid=form["studyid"], datasetid=new_datasetid, + totallines=form["totallines"]) except AssertionError as aserr: flash(f"Missing data {aserr.args[0]}", "alert-error") return redirect(url_for("dbinsert.select_dataset"), code=307) @@ -343,9 +347,9 @@ def final_confirmation(): datasetid=form["datasetid"] return render_template( "final_confirmation.html", filename=form["filename"], - filetype=form["filetype"], species=speciesid, genechipid=genechipid, - studyid=studyid, datasetid=datasetid, - the_species=selected_keys( + filetype=form["filetype"], totallines=form["totallines"], + species=speciesid, genechipid=genechipid, studyid=studyid, + datasetid=datasetid, the_species=selected_keys( species_by_id(speciesid), ("SpeciesName", "Name", "MenuName")), platform=selected_keys( platform_by_id(genechipid), @@ -378,9 +382,9 @@ def insert_data(): with Redis.from_url(redisurl, decode_responses=True) as rconn: job = jobs.launch_job( jobs.data_insertion_job( - rconn, filepath, form.get("filetype"), - form.get("species"), form.get("genechipid"), - form.get("datasetid"), app.config["SQL_URI"], redisurl, + rconn, filepath, form["filetype"], form["totallines"], + form["species"], form["genechipid"], form["datasetid"], + app.config["SQL_URI"], redisurl, app.config["JOBS_TTL_SECONDS"]), redisurl, f"{app.config['UPLOAD_FOLDER']}/job_errors") |