Skip to content

Commit 201ba92

Browse files
Create task.py
1 parent 9977523 commit 201ba92

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

aura-core/task.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import redis
2+
import os
3+
import json
4+
5+
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379/0")
6+
redis_client = redis.Redis.from_url(REDIS_URL)
7+
8+
def enqueue_task(session_id: str, task_name: str):
9+
task = {"session_id": session_id, "task": task_name}
10+
redis_client.lpush("aura:tasks", json.dumps(task))
11+
return task

0 commit comments

Comments
 (0)