mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
24 lines
538 B
Python
24 lines
538 B
Python
import os
|
|
import time
|
|
from celery import Celery
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
# Redis connection
|
|
redis_url = os.getenv("REDIS_URL", "redis://localhost:6379")
|
|
app = Celery('worker', broker=redis_url, backend=redis_url)
|
|
|
|
@app.task
|
|
def simple_task(message):
|
|
"""A simple task that processes a message and returns a result"""
|
|
time.sleep(2) # Simulate some work
|
|
return f"Processed: {message}"
|
|
|
|
@app.task
|
|
def add_numbers(x, y):
|
|
"""Simple math task"""
|
|
return x + y
|
|
|
|
if __name__ == '__main__':
|
|
app.start()
|