from celery import Celery from utils import restricted_exec app = Celery( 'tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0', task_send_sent_event=True, worker_send_task_events=True, worker_enable_remote_control=True, ) @app.task def restricted_exec_task(code: str): return restricted_exec.getoutput(code)