def _precalc_numbers(**kwargs):
    if not _precalc_table:
        for i in range(1024):
            _precalc_table[i] = i ** 2
task_prerun.connect(_precalc_numbers, sender=tasks[PowerOfTwo.name])
How can I set up Celery to call a custom initialization function before running my tasks?