diff options
Diffstat (limited to 'uploader/phenotypes/views.py')
-rw-r--r-- | uploader/phenotypes/views.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 04cdc3b..0e626ad 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -385,7 +385,7 @@ def process_phenotypes_individual_files(error_uri): arcname=filedata["original-name"]) cdata[rqtlkey] = cdata.get(rqtlkey, []) + [filedata["original-name"]] else: - # TODO: Check this path: fix any bugs. + # T0DO: Check this path: fix any bugs. _sentfile = request.files[formkey] if not bool(_sentfile): flash(f"Expected file ('{formkey}') was not provided.", @@ -640,12 +640,16 @@ def load_data_to_database( **kwargs ):# pylint: disable=[unused-argument] """Load the data from the given QC job into the database.""" - jobs_db = app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"] + _jobs_db = app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"] with (Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn, - sqlite3.connection(jobs_db) as conn): + sqlite3.connection(_jobs_db) as conn): + # T0DO: Maybe break the connection between the jobs here, pass: + # - the bundle name (rebuild the full path here.) + # - publication details, where separate + # - details about the files: e.g. total lines, etc qc_job = jobs.job(rconn, jobs.jobsnamespace(), request.form["data-qc-job-id"]) _meta = json.loads(qc_job["job-metadata"]) - load_job_id = uuid.uuid4() + _load_job_id = uuid.uuid4() _loglevel = logging.getLevelName(app.logger.getEffectiveLevel()).lower() command = [ sys.executable, @@ -653,8 +657,8 @@ def load_data_to_database( "-m", "scripts.load_phenotypes_to_db", app.config["SQL_URI"], - jobs_db, - str(load_job_id), + _jobs_db, + str(_load_job_id), "--log-level", _loglevel ] @@ -674,7 +678,7 @@ def load_data_to_database( ).then( lambda token: gnlibs_jobs.initialise_job( conn, - load_job_id, + _load_job_id, command, "load-new-phenotypes-data", extra_meta={ @@ -692,7 +696,7 @@ def load_data_to_database( ).then( lambda job: gnlibs_jobs.launch_job( job, - jobs_db, + _jobs_db, Path(f"{app.config['UPLOAD_FOLDER']}/job_errors"), worker_manager="gn_libs.jobs.launcher", loglevel=_loglevel) @@ -972,6 +976,7 @@ def load_data_success( job_id: uuid.UUID, **kwargs ):# pylint: disable=[unused-argument] + """Display success page if loading data to database was successful.""" with (database_connection(app.config["SQL_URI"]) as conn, sqlite3.connection(app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"]) as jobsconn): @@ -1016,5 +1021,5 @@ def load_data_success( "FormID": "searchResult" }), fragment=""))) - except JobNotFound as jnf: + except JobNotFound as _jnf: return render_template("jobs/job-not-found.html", job_id=job_id) |