feat(api): alerts dockerfile feat(api): alerts build script feat(backend): removed alerts
26 lines
747 B
Python
26 lines
747 B
Python
import logging
|
|
|
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|
from fastapi import FastAPI
|
|
|
|
from chalicelib.core import alerts_processor
|
|
|
|
app = FastAPI()
|
|
print("============= ALERTS =============")
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"status": "Running"}
|
|
|
|
|
|
app.schedule = AsyncIOScheduler()
|
|
app.schedule.start()
|
|
app.schedule.add_job(id="alerts_processor", **{"func": alerts_processor.process, "trigger": "interval", "minutes": 5,
|
|
"misfire_grace_time": 20})
|
|
|
|
for job in app.schedule.get_jobs():
|
|
print({"Name": str(job.id), "Run Frequency": str(job.trigger), "Next Run": str(job.next_run_time)})
|
|
|
|
logging.basicConfig()
|
|
logging.getLogger('apscheduler').setLevel(logging.INFO)
|