Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Flask_User_Reg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
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
Flask_User_Reg
Commits
3adc9f39
Commit
3adc9f39
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Begin celery implementation and call
parent
aed43b96
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!35
Version 1b openstack rabbitmq
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
run.py
+4
-2
4 additions, 2 deletions
run.py
tasks.py
+19
-0
19 additions, 0 deletions
tasks.py
with
23 additions
and
2 deletions
run.py
+
4
−
2
View file @
3adc9f39
...
...
@@ -3,8 +3,9 @@
import
os
import
time
import
signal
import
tasks
import
pika
from
flask
import
session
from
flask_socketio
import
SocketIO
,
join_room
...
...
@@ -55,7 +56,8 @@ def request_account(json, methods=['GET', 'POST']):
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Queue request received:
'
+
str
(
json
))
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_global
)
except
Exception
as
e
:
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Error in account creation:
"
,
e
)
...
...
This diff is collapsed.
Click to expand it.
tasks.py
0 → 100644
+
19
−
0
View file @
3adc9f39
from
celery
import
Celery
import
time
from
flask_socketio
import
SocketIO
from
gevent
import
monkey
monkey
.
patch_all
(
subprocess
=
True
)
celery
=
Celery
(
'
flask_user_reg
'
,
broker
=
'
amqp://
'
)
socketio
=
SocketIO
(
message_queue
=
'
amqp:///socketio
'
)
@celery.task
def
celery_create_account
(
username
,
fullname
,
reason
,
room
):
# Todo: Ravi's and Louis's code goes here
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
added to queue
'
)
socketio
.
emit
(
"
creating account
"
,
room
=
room
)
time
.
sleep
(
5
)
socketio
.
emit
(
'
account ready
'
,
room
=
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