Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
richardr1126 committed Jan 17, 2025
1 parent 14bcd74 commit a00b40c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion firehose/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
18 changes: 13 additions & 5 deletions firehose/start_stream.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import sys
import threading
import signal

from utils import config
from utils.logger import logger
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")


Expand Down
4 changes: 2 additions & 2 deletions scheduler/db_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit a00b40c

Please sign in to comment.