Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account_init_cleanup
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Mitchell Moore
account_init_cleanup
Commits
788ae21b
Commit
788ae21b
authored
5 years ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
modify the message_queue in socketio app
parent
35310b0e
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
run.py
+7
-5
7 additions, 5 deletions
run.py
with
7 additions
and
5 deletions
run.py
+
7
−
5
View file @
788ae21b
...
@@ -5,7 +5,6 @@ import time
...
@@ -5,7 +5,6 @@ import time
import
signal
import
signal
import
tasks
import
tasks
from
flask
import
session
from
flask
import
session
from
flask_socketio
import
SocketIO
,
join_room
from
flask_socketio
import
SocketIO
,
join_room
...
@@ -14,8 +13,9 @@ from app import create_app
...
@@ -14,8 +13,9 @@ from app import create_app
config_name
=
os
.
getenv
(
'
FLASK_CONFIG
'
)
config_name
=
os
.
getenv
(
'
FLASK_CONFIG
'
)
app
=
create_app
(
config_name
)
app
=
create_app
(
config_name
)
app
.
config
[
'
SECRET_KEY
'
]
=
'
vnkdjnfjknfl1232#
'
app
.
config
[
'
SECRET_KEY
'
]
=
'
vnkdjnfjknfl1232#
'
socketio
=
SocketIO
(
app
,
message_queue
=
'
amqp://reggie:reggie@ohpc:5672/socketio
'
)
#socketio = SocketIO(app)
#socketio = SocketIO(app, message_queue='amqp:///socketio')
#socketio = SocketIO(app, message_queue='amqp:///socketio')
socketio
=
SocketIO
(
app
)
# global username_global
# global username_global
# global room_global
# global room_global
...
@@ -55,13 +55,15 @@ def user_connected(json, methods=['GET', 'POST']):
...
@@ -55,13 +55,15 @@ def user_connected(json, methods=['GET', 'POST']):
@socketio.on
(
'
request account
'
)
@socketio.on
(
'
request account
'
)
def
request_account
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
def
request_account
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Queue request received:
'
+
str
(
json
))
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Queue request received:
'
+
str
(
json
))
print
(
json
)
#
print(json)
room
=
str
(
session
[
'
uid
'
])
room
=
str
(
session
[
'
uid
'
])
join_room
(
room
)
print
(
"
Room: {}
"
.
format
(
room
))
#socketio.emit("creating account")
#socketio.emit("creating account")
try
:
try
:
# create_account(json['username'], json['fullname'], json['reason'])
# create_account(json['username'], json['fullname'], json['reason'])
tasks
.
celery_create_account
(
json
[
'
username
'
],
json
[
'
fullname
'
],
json
[
'
reason
'
],
room
,
socketio
)
#
tasks.celery_create_account
.delay
(json['username'], json['fullname'], json['reason'], room, socketio
, session=room
)
tasks
.
celery_create_account
.
delay
(
json
[
'
username
'
],
json
[
'
fullname
'
],
json
[
'
reason
'
],
room
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Error in account creation:
"
,
e
)
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Error in account creation:
"
,
e
)
socketio
.
emit
(
"
Account creation failed
"
,
room
)
socketio
.
emit
(
"
Account creation failed
"
,
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