Skip to content

Commit 9e7f577

Browse files
authored
change percent progress reporting a bit (#42)
* change percent progress reporting a bit * fix bug when reporting progress * fix another tab bug * yet another tab bug * fix args bug
1 parent 52b8f20 commit 9e7f577

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/workers/work.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,19 @@ def km_work_all_vs_all(json: dict):
146146
if return_pmids:
147147
abc_result['bc_pmid_intersection'] = str(bc['pmid_intersection'])
148148

149-
# report percentage of C-terms complete
150-
_update_job_status('progress', round(((c_term_n + 1) / len(c_terms)), 2))
151-
else:
152-
# report percentage of A-B pairs complete
153-
_update_job_status('progress', round(((a_term_n + 1) / len(a_terms)), 2))
154-
155149
return_val.append(abc_result)
156150

151+
# report percentage of C-terms complete
152+
if not km_only:
153+
progress = round(((c_term_n + 1) / len(c_terms)), 4)
154+
else:
155+
# report percentage of A-B pairs complete
156+
progress = round(((a_term_n + 1) / len(a_terms)), 4)
157+
158+
# report progress but never report 100% progress until the job is actually done
159+
_update_job_status('progress', min(progress, 0.9999))
160+
161+
_update_job_status('progress', 1.0000)
157162
return return_val
158163

159164
def triple_miner_work(json: list):

0 commit comments

Comments
 (0)