diff --git a/Dockerfile b/Dockerfile index db5a939..e7cb5df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ COPY . . EXPOSE 8000 # Runs when the container is started -CMD gunicorn web.app:app --bind 0.0.0.0:8000 --workers 4 +CMD ["gunicorn", "web.app:app", "--bind", "0.0.0.0:8000", "--workers", "4"] diff --git a/firehose/Dockerfile b/firehose/Dockerfile index 40d3430..19bd4ef 100644 --- a/firehose/Dockerfile +++ b/firehose/Dockerfile @@ -10,4 +10,4 @@ COPY . . RUN pip install --no-cache-dir -r requirements.txt # Runs when the container is started -CMD python start_stream.py +CMD ["python", "start_stream.py"] diff --git a/firehose/start_stream.py b/firehose/start_stream.py index 917607c..ee0a6a1 100644 --- a/firehose/start_stream.py +++ b/firehose/start_stream.py @@ -1,5 +1,4 @@ import sys -import threading import signal from utils import config @@ -7,18 +6,27 @@ import data_stream as data_stream from data_filter import operations_callback +class StopEvent: + def __init__(self): + self._stopped = False + + def set(self): + self._stopped = True + + def is_set(self): + return self._stopped + def main(): - stream_stop_event = threading.Event() + stop_event = StopEvent() def handle_termination(signum, frame): logger.info(f'Received termination signal {signum}. Stopping firehose stream...') - stream_stop_event.set() + stop_event.set() sys.exit(0) signal.signal(signal.SIGINT, handle_termination) - - data_stream.run(config.SERVICE_DID, operations_callback, stream_stop_event) + data_stream.run(config.SERVICE_DID, operations_callback, stop_event) logger.info("firehose has exited") diff --git a/scheduler/db_scheduler.py b/scheduler/db_scheduler.py index 51653e4..97c402f 100644 --- a/scheduler/db_scheduler.py +++ b/scheduler/db_scheduler.py @@ -23,8 +23,8 @@ def main(): # Start Scheduler scheduler = start_scheduler(client, schedule_hydration=True) - for job in scheduler.get_jobs(): - job.modify(next_run_time=datetime.now()) # Trigger all jobs immediately + # for job in scheduler.get_jobs(): + # job.modify(next_run_time=datetime.now()) # Trigger all jobs immediately # Handle graceful shutdown def signal_handler(sig, frame):