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
7cf58dbd
Commit
7cf58dbd
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
create test harness
parent
0df23095
No related branches found
No related tags found
1 merge request
!2
Feat update ui (pre react)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
run.py
+3
-2
3 additions, 2 deletions
run.py
tasks.py
+23
-23
23 additions, 23 deletions
tasks.py
with
26 additions
and
25 deletions
run.py
+
3
−
2
View file @
7cf58dbd
...
@@ -16,7 +16,7 @@ monkey.patch_all(subprocess=True)
...
@@ -16,7 +16,7 @@ monkey.patch_all(subprocess=True)
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
'
]
=
vars
.
key
app
.
config
[
'
SECRET_KEY
'
]
=
vars
.
key
socketio
=
SocketIO
(
app
,
message_queue
=
vars
.
message_queue
)
socketio
=
SocketIO
(
app
)
...
@@ -36,7 +36,8 @@ def request_account(json, methods=['GET', 'POST']):
...
@@ -36,7 +36,8 @@ def request_account(json, methods=['GET', 'POST']):
room
=
str
(
session
[
'
uid
'
])
room
=
str
(
session
[
'
uid
'
])
print
(
"
Room: {}
"
.
format
(
room
))
print
(
"
Room: {}
"
.
format
(
room
))
try
:
try
:
tasks
.
celery_create_account
.
delay
(
json
[
'
username
'
],
json
[
'
fullname
'
],
json
[
'
reason
'
],
session
=
room
)
print
(
"
hi
"
)
# tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], session=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.
tasks.py
+
23
−
23
View file @
7cf58dbd
...
@@ -4,26 +4,26 @@ from flask_socketio import SocketIO
...
@@ -4,26 +4,26 @@ from flask_socketio import SocketIO
import
subprocess
import
subprocess
import
vars
import
vars
from
gevent
import
monkey
#
from gevent import monkey
monkey
.
patch_all
(
subprocess
=
True
)
#
monkey.patch_all(subprocess=True)
#
broker_url
=
vars
.
broker_url
#
broker_url = vars.broker_url
celery
=
Celery
(
'
flask_user_reg
'
,
broker
=
broker_url
)
#
celery = Celery('flask_user_reg', broker=broker_url)
#
socketio
=
SocketIO
(
message_queue
=
vars
.
message_queue
)
#
socketio = SocketIO(message_queue=vars.message_queue)
#
#
def
send_msg
(
event
,
room
):
#
def send_msg(event, room):
print
(
"
Post
'
{}
'
to room
'
{}
'"
.
format
(
event
,
room
))
#
print("Post '{}' to room '{}'".format(event,room))
socketio
.
emit
(
event
,
room
=
room
)
#
socketio.emit(event, room=room)
#
#
@celery.task
#
@celery.task
def
celery_create_account
(
username
,
fullname
,
reason
,
session
):
#
def celery_create_account(username, fullname, reason, session):
room
=
session
#
room = session
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
added to queue
'
)
#
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg
(
'
creating account
'
,
room
)
#
send_msg('creating account', room)
print
(
username
)
#
print(username)
subprocess
.
call
([
"
/opt/rabbitmq_agents/flask_producer.py
"
,
"
ohpc_account_create
"
,
username
])
#
subprocess.call(["/opt/rabbitmq_agents/flask_producer.py", "ohpc_account_create", username])
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Account successfully created for
'
+
username
)
#
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
send_msg
(
'
account ready
'
,
room
)
#
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