diff options
author | Stas Medvedev <medvedevsa97@gmail.com> | 2024-06-12 16:56:07 +0300 |
---|---|---|
committer | Stas Medvedev <medvedevsa97@gmail.com> | 2024-06-12 16:56:07 +0300 |
commit | 0c1a65570be7f34f12a35da45669676f4479abd4 (patch) | |
tree | eb0905e4a6454d154b679830666e31f066a9fea7 /app/tasks.py | |
parent | ed49bb17b9e93a1406ab51f7dca5906661863627 (diff) |
add utils.restricted_exec
add app.tasks
Diffstat (limited to 'app/tasks.py')
-rw-r--r-- | app/tasks.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/tasks.py b/app/tasks.py new file mode 100644 index 0000000..bba3fae --- /dev/null +++ b/app/tasks.py @@ -0,0 +1,17 @@ +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) |