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
86186e97
Commit
86186e97
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Include asyncronous delay. Remove old validate method. Add rough global username exchange
parent
e946d2e2
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
+15
-20
15 additions, 20 deletions
run.py
with
15 additions
and
20 deletions
run.py
+
15
−
20
View file @
86186e97
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
os
import
os
import
time
import
time
import
s
ubprocess
import
s
ignal
import
pika
import
pika
from
flask_socketio
import
SocketIO
from
flask_socketio
import
SocketIO
...
@@ -14,6 +14,7 @@ app = create_app(config_name)
...
@@ -14,6 +14,7 @@ app = create_app(config_name)
app
.
config
[
'
SECRET_KEY
'
]
=
'
vnkdjnfjknfl1232#
'
app
.
config
[
'
SECRET_KEY
'
]
=
'
vnkdjnfjknfl1232#
'
socketio
=
SocketIO
(
app
)
socketio
=
SocketIO
(
app
)
global
username_global
def
messageReceived
(
methods
=
[
'
GET
'
,
'
POST
'
]):
def
messageReceived
(
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
'
message was received!!!
'
)
print
(
'
message was received!!!
'
)
...
@@ -42,25 +43,33 @@ def check_dir(user, interval):
...
@@ -42,25 +43,33 @@ def check_dir(user, interval):
def
create_account
(
username
,
fullname
,
reason
):
def
create_account
(
username
,
fullname
,
reason
):
# Todo: Ravi's and Louis's code go here
# Todo: Ravi's and Louis's code go
es
here
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
added to queue
'
)
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
added to queue
'
)
global
username_global
username_global
=
username
socketio
.
emit
(
"
creating account
"
)
socketio
.
emit
(
"
creating account
"
)
signal
.
signal
(
signal
.
SIGALRM
,
account_agent
)
signal
.
alarm
(
5
)
def
account_
confirmation
(
username
):
def
account_
agent
(
*
args
):
# Todo: Code to create a consumer based on the username goes here
# Todo: Code to create a consumer based on the username goes here
# Todo: Goal is to have it listening for confirmation.
# Todo: Goal is to have it listening for confirmation.
global
username_global
username
=
username_global
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Account successfully created for
'
+
username
)
socketio
.
emit
(
"
account ready
"
)
return
True
return
True
@socketio.on
(
'
user connect
'
)
@socketio.on
(
'
user connect
ed
'
)
def
handle_my_custom_event
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
def
user_connected
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
username
=
json
[
"
user
"
]
username
=
json
[
"
user
"
]
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
connected.
'
)
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
connected.
'
)
@socketio.on
(
'
request account
'
)
@socketio.on
(
'
request account
'
)
def
ingest_data
(
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
))
try
:
try
:
...
@@ -71,20 +80,6 @@ def ingest_data(json, methods=['GET', 'POST']):
...
@@ -71,20 +80,6 @@ def ingest_data(json, methods=['GET', 'POST']):
socketio
.
emit
(
"
Account creation failed
"
)
socketio
.
emit
(
"
Account creation failed
"
)
@socketio.on
(
"
validate creation
"
)
def
creation_confirmation
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
# User create Script Approach
username
=
json
[
"
username
"
]
if
account_confirmation
(
username
):
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Account successfully created for
'
+
username
)
socketio
.
emit
(
"
Account created
"
)
else
:
socketio
.
emit
(
"
Account creation failed
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
# app.run()
# app.run()
socketio
.
run
(
app
)
socketio
.
run
(
app
)
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