2020-06-08 08:23:32 +00:00
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
2020-06-05 12:42:04 +00:00
|
|
|
from tasks.check_corpora import check_corpora
|
2020-06-08 08:23:32 +00:00
|
|
|
from tasks.check_jobs import check_jobs
|
2020-06-05 12:42:04 +00:00
|
|
|
from tasks.notify import notify
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
|
2020-06-05 13:17:37 +00:00
|
|
|
# TODO: Check if thread is still alive and execute next thread after that
|
2020-06-05 13:25:16 +00:00
|
|
|
# TODO: Check line length
|
2020-06-05 13:17:37 +00:00
|
|
|
|
|
|
|
|
2020-06-05 12:42:04 +00:00
|
|
|
def nopaqued():
|
|
|
|
# executing background functions
|
|
|
|
while True:
|
2020-06-08 08:23:32 +00:00
|
|
|
with ThreadPoolExecutor(max_workers=3) as executor:
|
|
|
|
executor.submit(check_jobs)
|
|
|
|
executor.submit(check_corpora)
|
|
|
|
executor.submit(notify, True) # If True mails are sent.
|
|
|
|
# If False no mails are sent.
|
|
|
|
# But notification status will be set nonetheless.
|
2020-06-05 12:42:04 +00:00
|
|
|
sleep(3)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
nopaqued()
|