aboutsummaryrefslogtreecommitdiff
path: root/qc_app
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/dbinsert.py14
-rw-r--r--qc_app/jobs.py3
2 files changed, 11 insertions, 6 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py
index 5381fb5..fac546b 100644
--- a/qc_app/dbinsert.py
+++ b/qc_app/dbinsert.py
@@ -81,7 +81,8 @@ def select_dataset():
types=group_types, datasets=datasets,
menu_contents=json.dumps(menu_contents),
genechips_data=json.dumps(gchips),
- genechips=gchips.get(default_species, []))
+ genechips=gchips.get(default_species, []),
+ filetype=job["filetype"])
return render_error(f"File '{filename}' no longer exists.")
return render_error(f"Job '{job_id}' no longer exists.")
return render_error("Unknown error")
@@ -95,10 +96,13 @@ def insert_data():
filepath = f"{app.config['UPLOAD_FOLDER']}/{filename}"
if os.path.exists(filepath):
try:
- dataset_id = int(form["dataset"])
- return (f"Would insert data in file '{filepath}' "
- "into the database with the dataset "
- f"{dataset_id}")
+ species = form["species"]
+ filetype = form["filetype"]
+ datasetid = int(form["dataset"])
+ genechipid = int(form["genechipid"])
+ return (f"Would insert '{species}' data in '{filetype}' file "
+ f"'{filepath}' into the database with the dataset "
+ f"'{datasetid}' and genechip '{genechipid}'.")
except ValueError as ve:
msg = "::".join(ve.args)
return render_error(f"Invalid value: {msg}")
diff --git a/qc_app/jobs.py b/qc_app/jobs.py
index 4e6a11e..275f9c8 100644
--- a/qc_app/jobs.py
+++ b/qc_app/jobs.py
@@ -20,7 +20,8 @@ def launch_job(# pylint: disable=[too-many-arguments]
"python3", "-m", "scripts.worker", filetype, filepath, redisurl, job_id]
the_job = {
"job_id": job_id, "command": shlex.join(command), "status": "pending",
- "filename": os.path.basename(filepath), "percent": 0
+ "filename": os.path.basename(filepath), "percent": 0,
+ "filetype": filetype
}
redis_conn.hset(name=the_job["job_id"], mapping=the_job)
redis_conn.expire(name=the_job["job_id"], time=timedelta(seconds=ttl_seconds))