* fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(alerts): fixed loggers refactor(chalice): refactored health-check logging refactor(chalice): upgraded dependencies refactor(alerts): upgraded dependencies refactor(crons): upgraded dependencies
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
print("============= CRONS =============")
|
|
import asyncio
|
|
import logging
|
|
import sys
|
|
|
|
from crons import core_dynamic_crons, ee_crons
|
|
|
|
logger = logging.getLogger(__name__)
|
|
ACTIONS = {
|
|
"TELEMETRY": core_dynamic_crons.telemetry_cron,
|
|
"JOB": core_dynamic_crons.run_scheduled_jobs,
|
|
"REPORT": core_dynamic_crons.weekly_report,
|
|
"PROJECTS_STATS": core_dynamic_crons.health_cron,
|
|
"FIX_PROJECTS_STATS": core_dynamic_crons.weekly_health_cron,
|
|
"ASSIST_STATS": ee_crons.assist_events_aggregates_cron,
|
|
}
|
|
|
|
|
|
def default_action(action):
|
|
async def _func():
|
|
logger.warning(f"{action} not found in crons-definitions")
|
|
logger.warning("possible actions:")
|
|
logger.warning(list(ACTIONS.keys()))
|
|
|
|
return _func
|
|
|
|
|
|
async def process(action):
|
|
await ACTIONS.get(action.upper(), default_action(action))()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) < 2 or len(sys.argv[1]) < 1:
|
|
logger.warning("please provide actions as argument\npossible actions:")
|
|
logger.warning(list(ACTIONS.keys()))
|
|
else:
|
|
logger.info(f"action: {sys.argv[1]}")
|
|
asyncio.run(process(sys.argv[1]))
|