Skip to content
Snippets Groups Projects
Commit 6091979e authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

Added docstring for module and functions in tasks.py

parent 3638497e
No related branches found
No related tags found
No related merge requests found
"""
This python module defines celery tasks for following fucntions:
* Account creation
* Account certification
"""
# standard imports # standard imports
import json import json
import sys import sys
...@@ -22,7 +27,24 @@ timeout = 30 ...@@ -22,7 +27,24 @@ timeout = 30
def gen_f(room): def gen_f(room):
"""
This function defines the callback function for creating account process.
Inputs:
room: Room/session ID for the flask session, so that communications are going to the right session.
Output:
RabbitMQ callback function.
"""
def callback(channel, method, properties, body): def callback(channel, method, properties, body):
"""
This function defines the RabbitMQ callback function executed after account creation process.
Inputs:
channel: channel over which the RabbitMQ communication is happening.
method: Defines meta information regarding the message delivery.
properties: user-defined properties on the message
body: Message that is passed throughout account creation process across multiple agents.
Output:
Send appropriate message to the frontend, for account creation success or failure. And delete the queue.
"""
msg = json.loads(body) msg = json.loads(body)
username = msg["username"] username = msg["username"]
queuename = msg["queuename"] queuename = msg["queuename"]
...@@ -44,7 +66,24 @@ def gen_f(room): ...@@ -44,7 +66,24 @@ def gen_f(room):
def certify_gen_f(room): def certify_gen_f(room):
"""
This function defines the callback function for certifying account process.
Inputs:
room: Room/session ID for the flask session, so that communications are going to the right session.
Output:
RabbitMQ callback function.
"""
def callback(channel, method, properties, body): def callback(channel, method, properties, body):
"""
This function defines the RabbitMQ callback function executed after account certification process.
Inputs:
channel: channel over which the RabbitMQ communication is happening.
method: Defines meta information regarding the message delivery.
properties: user-defined properties on the message
body: Message that is passed throughout account creation process across multiple agents.
Output:
Send appropriate message to the frontend, for account certification success or failure. And delete the queue.
"""
msg = json.loads(body) msg = json.loads(body)
username = msg["username"] username = msg["username"]
queuename = msg["queuename"] queuename = msg["queuename"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment