You can download this code by clicking the button below.
This code is now available for download.
This function is a Celery task that takes two arguments, adds them, and returns the result. It uses the Celery framework for asynchronous task processing and logs parameter information using logging functionality.
Technology Stack : Celery, Python
Code Type : Celery task function
Code Difficulty : Intermediate
def random_task(arg1, arg2):
from celery import Celery
from celery.utils.log import get_task_logger
app = Celery('tasks', broker='pyamqp://guest@localhost//')
logger = get_task_logger(__name__)
logger.info(f"Processing argument 1: {arg1}, argument 2: {arg2}")
return arg1 + arg2