aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/worker.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/worker.py b/scripts/worker.py
index 6fab9f9..0ef5ae5 100644
--- a/scripts/worker.py
+++ b/scripts/worker.py
@@ -54,6 +54,16 @@ def stream_error(redis_conn, job_id, error):
redis_conn.hset(
job_id, key="errors", value=jsonpickle.encode(errors + (error,)))
+def make_user_aborted(redis_conn, job_id):
+ def __aborted__():
+ user_aborted = bool(int(
+ redis_conn.hget(name=job_id, key="user_aborted") or "0"))
+ if user_aborted:
+ redis_conn.hset(name=job_id, key="status", value="aborted")
+
+ return user_aborted
+ return __aborted__
+
def main():
args = process_cli_arguments()
if args is None:
@@ -79,7 +89,8 @@ def main():
error_count = 0
for error in collect_errors(
- filepath, filetype, strains, progress_indicator):
+ filepath, filetype, strains, progress_indicator,
+ make_user_aborted(redis_conn, args.job_id)):
stream_error(redis_conn, args.job_id, error)
if count > 0: