Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
self-reg-form
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krish Moodbidri
self-reg-form
Commits
6091979e
Commit
6091979e
authored
3 years ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
Added docstring for module and functions in tasks.py
parent
3638497e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks.py
+39
-0
39 additions, 0 deletions
tasks.py
with
39 additions
and
0 deletions
tasks.py
+
39
−
0
View file @
6091979e
"""
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
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment