Skip to content
Snippets Groups Projects
Commit 7b8f1f4c authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Merge branch 'feat-add-docstring-in-task' into 'fix-linting'

Feat add docstring in task

See merge request louistw/self-reg-form!4
parents 45ef4c2a 6091979e
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