Initial commit
This commit is contained in:
45
birb_scheduler/main.py
Normal file
45
birb_scheduler/main.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env pyton3
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
|
||||
from config import Config
|
||||
from apscheduler.schedulers.blocking import BlockingScheduler
|
||||
|
||||
|
||||
def run():
|
||||
logging.info("Csirip")
|
||||
|
||||
|
||||
def main():
|
||||
sentry_logging = LoggingIntegration(
|
||||
level=logging.INFO,
|
||||
event_level=logging.ERROR
|
||||
)
|
||||
|
||||
if Config.SENTRY_DSN:
|
||||
sentry_sdk.init(
|
||||
dsn=Config.SENTRY_DSN,
|
||||
integrations=[sentry_logging],
|
||||
traces_sample_rate=0.0,
|
||||
send_default_pii=True,
|
||||
release=Config.RELEASE_ID,
|
||||
environment=Config.RELEASEMODE,
|
||||
_experiments={"auto_enabling_integrations": True}
|
||||
)
|
||||
|
||||
logging.basicConfig(
|
||||
stream=sys.stdout,
|
||||
format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
||||
level=logging.DEBUG if Config.DEBUG else logging.INFO
|
||||
)
|
||||
|
||||
scheduler = BlockingScheduler()
|
||||
scheduler.add_job(run, trigger='interval', seconds=Config.INTERVAL)
|
||||
scheduler.start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user