From 6d804a3a45272a5ccf9598c7a3496522b9f6b5ce Mon Sep 17 00:00:00 2001 From: Kyle Anderson Date: Thu, 22 Feb 2024 14:35:18 -0500 Subject: [PATCH 01/28] Fix dict KeyError in cravat_convert Re: https://github.com/KarchinLab/open-cravat/issues/210 TODO: add a unit test for this; cravat_convert.MasterCravatConverter.run() is a monster of a function, so it was taking a long time to get this test running. Find the WIP version on branch chore/210/cravat_convert_unit_test --- cravat/cravat_convert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cravat/cravat_convert.py b/cravat/cravat_convert.py index ee695dea..a15df6ad 100644 --- a/cravat/cravat_convert.py +++ b/cravat/cravat_convert.py @@ -450,7 +450,7 @@ def run(self): chrom = "chrM" wdict["chrom"] = self.chromdict.get(chrom, chrom) if multiple_files: - if wdict["sample_id"]: + if "sample_id" in wdict: wdict["sample_id"] = "__".join( [samp_prefix, wdict["sample_id"]] ) From a76777dde4b093adb9fb94b6cab3c64f0ab0ac99 Mon Sep 17 00:00:00 2001 From: Kyle Moad Date: Mon, 26 Feb 2024 13:55:09 -0500 Subject: [PATCH 02/28] allow fetching error file --- cravat/websubmit/nocache/websubmit.js | 22 +++++++++++++++++----- cravat/websubmit/websubmit.py | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/cravat/websubmit/nocache/websubmit.js b/cravat/websubmit/nocache/websubmit.js index d0e6c620..9323dad5 100644 --- a/cravat/websubmit/nocache/websubmit.js +++ b/cravat/websubmit/nocache/websubmit.js @@ -562,13 +562,25 @@ function populateJobTr (job) { logLink.setAttribute('href','/submit/jobs/' + job.id + '/log'); logLink.setAttribute('target', '_blank'); logLink.setAttribute('title', 'Click to download.'); - var button = getEl('button'); - button.classList.add('butn'); - button.classList.add('active-download-button'); - addEl(button, getTn('Log')); - addEl(logLink, button); + var logButton = getEl('button'); + logButton.classList.add('butn'); + logButton.classList.add('active-download-button'); + addEl(logButton, getTn('Log')); + addEl(logLink, logButton); addEl(dbTd, logLink); addEl(jobTr, dbTd); + // Err + var errLink = getEl('a'); + errLink.setAttribute('href','/submit/jobs/' + job.id + '/err'); + errLink.setAttribute('target', '_blank'); + errLink.setAttribute('title', 'Check for per-variant errors.'); + var errButton = getEl('button'); + errButton.classList.add('butn'); + errButton.classList.add('active-download-button'); + addEl(errButton, getTn('Errors')); + addEl(errLink, errButton); + addEl(dbTd, errLink); + addEl(jobTr, dbTd); // + button var btn = getEl('button'); btn.classList.add('butn'); diff --git a/cravat/websubmit/websubmit.py b/cravat/websubmit/websubmit.py index 92dcfd3a..daecd58d 100644 --- a/cravat/websubmit/websubmit.py +++ b/cravat/websubmit/websubmit.py @@ -209,6 +209,16 @@ async def job_log (self, request, job_id): else: log_path = None return log_path + + async def job_err (self, request, job_id): + run_path = await self.job_run_path(request, job_id) + if run_path is not None: + err_path = run_path + '.err' + if os.path.exists(err_path) == False: + err_path = None + else: + err_path = None + return err_path class WebJob(object): def __init__(self, job_dir, job_status_fpath): @@ -705,6 +715,19 @@ async def get_job_log (request): else: return web.Response(text='log file does not exist.') +async def get_job_err (request): + global filerouter + job_id = request.match_info['job_id'] + err_path = await filerouter.job_err(request, job_id) + if err_path is not None: + if os.stat(err_path).st_size == 0: + return web.Response(text='No errors') + else: + with open(err_path) as f: + return web.Response(text=f.read()) + else: + return web.Response(text='log file does not exist.') + def get_valid_report_types(): global valid_report_types if valid_report_types is not None: @@ -1278,6 +1301,7 @@ async def import_job (request): routes.append(['POST','/submit/jobs/{job_id}/reports/{report_type}',generate_report]) routes.append(['GET','/submit/jobs/{job_id}/reports/{report_type}',download_report]) routes.append(['GET','/submit/jobs/{job_id}/log',get_job_log]) +routes.append(['GET','/submit/jobs/{job_id}/err',get_job_err]) routes.append(['GET', '/submit/getjobsdir', get_jobs_dir]) routes.append(['GET', '/submit/setjobsdir', set_jobs_dir]) routes.append(['GET', '/submit/getsystemconfinfo', get_system_conf_info]) From 87cd2ac4a9bd1195cc97d89fba0c590c28f4514e Mon Sep 17 00:00:00 2001 From: Kyle Moad Date: Wed, 13 Mar 2024 11:28:21 -0400 Subject: [PATCH 03/28] change quicksave help text --- cravat/webresult/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cravat/webresult/index.html b/cravat/webresult/index.html index ddf23aa2..23aa7c2d 100644 --- a/cravat/webresult/index.html +++ b/cravat/webresult/index.html @@ -98,7 +98,7 @@
- +