From 59b27d96cad3f79a7afad71ef11a58b6b0f39bef Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Fri, 5 Jun 2020 15:17:37 +0200 Subject: [PATCH 1/3] Add todos --- daemon/nopaqued.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/daemon/nopaqued.py b/daemon/nopaqued.py index 537b3e02..af70c720 100644 --- a/daemon/nopaqued.py +++ b/daemon/nopaqued.py @@ -4,6 +4,23 @@ from tasks.notify import notify from time import sleep +# TODO: Check if thread is still alive and execute next thread after that +# TODO: Remove unnecessary commits +# check_jobs_thread = None +# check_corpora_thread = None +# notify_thread = None +# +# +# def nopaqued(): +# # executing background functions +# while True: +# check_jobs_thread = check_jobs() +# check_corpora_thread = check_corpora() +# notify_thread = notify(True) # If True mails are sent. If False no mails are sent. +# # But notification status will be set nonetheless. +# sleep(3) + + def nopaqued(): # executing background functions while True: From bb6878402637b811f0d6091b832d78f1c5dd6733 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Fri, 5 Jun 2020 15:19:01 +0200 Subject: [PATCH 2/3] Fix --- daemon/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/decorators.py b/daemon/decorators.py index 19d80d8e..040250a8 100644 --- a/daemon/decorators.py +++ b/daemon/decorators.py @@ -11,4 +11,4 @@ def background(f): thread = Thread(target=f, args=args, kwargs=kwargs) thread.start() return thread - return wrapped \ No newline at end of file + return wrapped From 9e88330433b46e3cf7484bd2076e7332df6466b8 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Fri, 5 Jun 2020 15:25:16 +0200 Subject: [PATCH 3/3] Remove unecessary sessions --- daemon/nopaqued.py | 1 + daemon/tasks/check_jobs.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/daemon/nopaqued.py b/daemon/nopaqued.py index af70c720..2498f75e 100644 --- a/daemon/nopaqued.py +++ b/daemon/nopaqued.py @@ -6,6 +6,7 @@ from time import sleep # TODO: Check if thread is still alive and execute next thread after that # TODO: Remove unnecessary commits +# TODO: Check line length # check_jobs_thread = None # check_corpora_thread = None # notify_thread = None diff --git a/daemon/tasks/check_jobs.py b/daemon/tasks/check_jobs.py index e699e12e..2b43f0b2 100644 --- a/daemon/tasks/check_jobs.py +++ b/daemon/tasks/check_jobs.py @@ -104,7 +104,6 @@ def __create_job_service(job): def __checkout_job_service(job, scoped_session): logger = init_logger() - scoped_session = Session() service_name = 'job_{}'.format(job.id) try: service = docker_client.services.get(service_name) @@ -136,7 +135,6 @@ def __checkout_job_service(job, scoped_session): job_result = JobResult(dir=results_dir, filename=result, job_id=job.id) scoped_session.add(job_result) - scoped_session.commit() def __remove_job_service(job):