2021-03-04 16:06:14 +01:00
|
|
|
# standard imports
|
2021-02-01 18:12:51 +01:00
|
|
|
import datetime
|
|
|
|
|
2021-03-04 16:06:14 +01:00
|
|
|
# external imports
|
2021-02-01 18:12:51 +01:00
|
|
|
import celery
|
|
|
|
|
2021-03-04 16:06:14 +01:00
|
|
|
# local imports
|
|
|
|
from cic_eth.db.models.debug import Debug
|
|
|
|
from cic_eth.db.models.base import SessionBase
|
|
|
|
from cic_eth.task import CriticalSQLAlchemyTask
|
|
|
|
|
2021-02-01 18:12:51 +01:00
|
|
|
celery_app = celery.current_app
|
|
|
|
|
|
|
|
|
2021-03-04 16:06:14 +01:00
|
|
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
|
|
|
def alert(chained_input, tag, txt):
|
|
|
|
session = SessionBase.create_session()
|
|
|
|
|
|
|
|
o = Debug(tag, txt)
|
|
|
|
session.add(o)
|
|
|
|
session.commit()
|
|
|
|
|
|
|
|
session.close()
|
|
|
|
|
|
|
|
return chained_input
|