mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 09:15:41 +00:00
27 lines
874 B
Python
27 lines
874 B
Python
from concurrent.futures import ThreadPoolExecutor
|
|
from tasks.check_corpora import check_corpora
|
|
from tasks.check_jobs import check_jobs
|
|
from tasks.notify import notify
|
|
import os
|
|
|
|
|
|
# TODO: Check if thread is still alive and execute next thread after that
|
|
# TODO: Check line length
|
|
|
|
|
|
def nopaqued():
|
|
execute_notifications = bool(os.environ.get('NOPAQUE_EXECUTE_NOTIFICATIONS')) # noqa
|
|
# executing background functions
|
|
while True:
|
|
with ThreadPoolExecutor(max_workers=3) as executor:
|
|
executor.submit(check_jobs)
|
|
executor.submit(check_corpora)
|
|
executor.submit(notify, execute_notifications)
|
|
# If execute_notifications True mails are sent.
|
|
# If execute_notifications False no mails are sent.
|
|
# But notification status will be set nonetheless.
|
|
|
|
|
|
if __name__ == '__main__':
|
|
nopaqued()
|