blob: 9402740b996a64a18db455c645e57383ae593dbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from celery import Celery
from utils import restricted_exec
from app.config import config
app = Celery(
'tasks',
broker=f'redis://{config["REDIS_HOST"]}:6379/0',
backend=f'redis://{config["REDIS_HOST"]}: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)
|