Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account-app
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
rc
account-app
Commits
ff4505b0
Commit
ff4505b0
authored
4 years ago
by
Krish Moodbidri
Browse files
Options
Downloads
Patches
Plain Diff
added callback function with error print to command line
parent
c95fc667
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
made UI changes to the app
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks.py
+15
-2
15 additions, 2 deletions
tasks.py
with
15 additions
and
2 deletions
tasks.py
+
15
−
2
View file @
ff4505b0
...
...
@@ -4,6 +4,7 @@ from flask_socketio import SocketIO
import
subprocess
import
vars
import
sys
import
json
sys
.
path
.
append
(
'
/cm/shared/rabbitmq_agents/
'
)
import
rc_util
...
...
@@ -16,7 +17,18 @@ celery = Celery('flask_user_reg', broker=broker_url)
socketio
=
SocketIO
(
message_queue
=
vars
.
message_queue
)
def
callback
():
def
callback
(
channel
,
method
,
properties
,
body
):
msg
=
json
.
loads
(
body
)
username
=
msg
[
'
username
'
]
if
msg
[
'
success
'
]:
print
(
f
'
Account for
{
username
}
has been created.
'
)
else
:
print
(
f
"
There
'
s some issue while creating account for
{
username
}
"
)
errmsg
=
msg
.
get
(
'
errmsg
'
,
[])
for
err
in
errmsg
:
print
(
err
)
rc_util
.
rc_rmq
.
stop_consume
()
rc_util
.
rc_rmq
.
delete_queue
()
...
...
@@ -39,4 +51,5 @@ def celery_create_account(json, session):
rc_util
.
add_account
(
username
,
email
,
fullname
,
reason
)
print
(
'
sent account info
'
)
print
(
'
Waiting for completion...
'
)
rc_util
.
consume
(
username
,
routing_key
=
f
'
complete.
{
username
}
'
,
callback
=
callback
)
rc_util
.
consume
(
username
,
routing_key
=
f
'
complete.
{
username
}
'
,
callback
=
callback
)
send_msg
(
'
account ready
'
,
room
)
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