Commit 896a7c56 authored by David Mendez's avatar David Mendez

Add base structure for tasks daemon

parent bcf192ec
"""
Module that implements the daemon that checks for reindexing tasks that need to be done
"""
def check_for_tasks_to_do():
"""
Checks if there are reindexing tasks to perform
:return: (sleeptime, jobs_were_checked) the amount of seconds to wait for the next run and if the tasks to do were
checked or not
"""
print('Checking for tasks to do...')
return 1, True
#!/usr/bin/env python3
"""
Script that runs the daemon that checks and runs the reindexing tasks
"""
import time
from app.tasks_daemon import daemon
from app import create_app
def run():
flask_app = create_app()
with flask_app.app_context():
while True:
sleep_time, jobs_were_checked = daemon.check_for_tasks_to_do()
time.sleep(sleep_time)
if __name__ == "__main__":
run()
\ No newline at end of file
#!/usr/bin/env bash
set -x
PYTHONPATH=$PYTHONPATH:$(pwd) python3 -u app/tasks_daemon/run_daemon.py
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment