mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from tasks.check_corpora import check_corpora
|
|
from tasks.check_jobs import check_jobs
|
|
from tasks.notify import notify
|
|
from time import sleep
|
|
import os
|
|
|
|
|
|
def nopaqued():
|
|
NOPAQUE_EXECUTE_NOTIFICATIONS = os.environ.get('NOPAQUE_EXECUTE_NOTIFICATIONS', 'True').lower() == 'true' # noqa
|
|
threads = {'check_corpora': None, 'check_jobs': None, 'notify': None}
|
|
|
|
threads['check_corpora'] = check_corpora()
|
|
threads['check_jobs'] = check_jobs()
|
|
threads['notify'] = notify(NOPAQUE_EXECUTE_NOTIFICATIONS)
|
|
while True:
|
|
if not threads['check_corpora'].is_alive():
|
|
threads['check_corpora'] = check_corpora()
|
|
if not threads['check_jobs'].is_alive():
|
|
threads['check_jobs'] = check_jobs()
|
|
if not threads['notify'].is_alive():
|
|
threads['notify'] = notify(NOPAQUE_EXECUTE_NOTIFICATIONS)
|
|
# If execute_notifications True mails are sent.
|
|
# If execute_notifications False no mails are sent.
|
|
# But notification status will be set nonetheless.
|
|
sleep(3)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
nopaqued()
|