giskard-evaluator / run_jobs.py
inoki-giskard's picture
GSK-2434 Add component to show logs (#17)
8f809e2
raw
history blame
No virus
720 Bytes
from io_utils import pop_job_from_pipe
import time
import threading
def start_process_run_job():
try:
print("Running jobs in thread")
global thread
thread = threading.Thread(target=run_job)
thread.daemon = True
thread.do_run = True
thread.start()
except Exception as e:
print("Failed to start thread: ", e)
def stop_thread():
print("Stop thread")
thread.do_run = False
def run_job():
while True:
print(thread.do_run)
try:
pop_job_from_pipe()
time.sleep(10)
except KeyboardInterrupt:
print("KeyboardInterrupt stop background thread")
stop_thread()
break