def periodic_job_definitions():
    jobs = [
        {"func": refresh_queries, "timeout": 600, "interval": 30, "result_ttl": 600},
        {
            "func": remove_ghost_locks,
            "interval": timedelta(minutes=1),
            "result_ttl": 600,
        },
        {"func": empty_schedules, "interval": timedelta(minutes=60)},
        {
            "func": refresh_schemas,
            "interval": timedelta(minutes=settings.SCHEMAS_REFRESH_SCHEDULE),
        },
        {"func": sync_user_details, "timeout": 60, "interval": timedelta(minutes=1),},
        {"func": purge_failed_jobs, "timeout": 3600, "interval": timedelta(days=1)},
        {
            "func": send_aggregated_errors,
            "interval": timedelta(minutes=settings.SEND_FAILURE_EMAIL_INTERVAL),
        },
    ]

    if settings.VERSION_CHECK:
        jobs.append({"func": version_check, "interval": timedelta(days=1)})

    if settings.QUERY_RESULTS_CLEANUP_ENABLED:
        jobs.append({"func": cleanup_query_results, "interval": timedelta(minutes=5)})

    # Add your own custom periodic jobs in your dynamic_settings module.
    jobs.extend(settings.dynamic_settings.periodic_jobs() or [])

    # Add periodic jobs that are shipped as part of Redash extensions
    extensions.load_periodic_jobs(logger)
    jobs.extend(list(extensions.periodic_jobs.values()))

    return jobs
 def test_dummy_periodic_task(self):
     # need to load the periodic tasks manually since this isn't
     # done automatically on test suite start but only part of
     # the worker configuration
     extensions.load_periodic_jobs(logger)
     self.assertIn("dummy_periodic_job", extensions.periodic_jobs.keys())