giskard-evaluator / run_jobs.py
inoki-giskard's picture
Format code and imports
58c39e0
raw
history blame
844 Bytes
import logging
import threading
import time
import pipe
from io_utils import pop_job_from_pipe
is_running = False
def start_process_run_job():
try:
logging.debug("Running jobs in thread")
global thread, is_running
thread = threading.Thread(target=run_job)
thread.daemon = True
is_running = True
pipe.init()
thread.start()
except Exception as e:
print("Failed to start thread: ", e)
def stop_thread():
logging.debug("Stop thread")
global is_running
is_running = False
def run_job():
global is_running
while is_running:
try:
pop_job_from_pipe()
time.sleep(10)
except KeyboardInterrupt:
logging.debug("KeyboardInterrupt stop background thread")
is_running = False
break