'run-every-60-seconds': {
# Name of task to run (see the "Tasks" section below)
'task': 'appdata.tasks.my_task_without_self,
# Task interval
'schedule': timedelta(seconds=60),
# Task arguments (see the "Tasks" section below)
# 'args': ()
},
def register_logger(app):
"""Register application logger."""
import os, os.path
if not os.path.exists("logs/"):
os.makedirs("logs/")
# main logger
handler = RotatingFileHandler('logs/main.log', maxBytes=10000, backupCount=1)
handler.setLevel(logging.INFO)
handler.setFormatter(
logging.Formatter("[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
)
app.logger.addHandler(handler)
# module_a logger
handler = RotatingFileHandler('logs/module_1.log', maxBytes=10000, backupCount=1)
handler.setLevel(logging.INFO)
handler.setFormatter(
logging.Formatter("[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
)
logging.getLogger('appdata.module_a').addHandler(handler)
logging.getLogger('appdata.module_a').info('test') # не пишет сюда!
result = Context.query.join(
Request, Request.context_id == Context.id_
).join(
Point, Point.request_id == Request.id_
).disctinct(
Point.attr
).group_by(Context.id_).with_entities(
Context,
func.count(Point.id_).label('points_count'),
func.count(case([and_(Request.visible == True, Point.visible == True), 1],
else_=literal_column("NULL"))).label('visible_points_count')
)
func.count(case([and_(Request.visible == True, Point.visible == True), 1], else_=literal_column("NULL"))).label('visible_points_count')