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
85faec75
Commit
85faec75
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
(unstable) add room functionality for testing
parent
96485dbb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run.py
+13
-13
13 additions, 13 deletions
run.py
with
13 additions
and
13 deletions
run.py
+
13
−
13
View file @
85faec75
...
@@ -16,14 +16,13 @@ app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
...
@@ -16,14 +16,13 @@ app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio
=
SocketIO
(
app
)
socketio
=
SocketIO
(
app
)
global
username_global
global
username_global
global
room_global
def
create_account
(
username
,
fullname
,
reason
):
def
create_account
(
username
,
fullname
,
reason
):
# Todo: Ravi's and Louis's code goes here
# Todo: Ravi's and Louis's code goes 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
socketio
.
emit
(
"
creating account
"
,
room
=
room_global
)
username_global
=
username
socketio
.
emit
(
"
creating account
"
)
signal
.
signal
(
signal
.
SIGALRM
,
account_agent
)
signal
.
signal
(
signal
.
SIGALRM
,
account_agent
)
signal
.
alarm
(
5
)
signal
.
alarm
(
5
)
...
@@ -32,22 +31,23 @@ def account_agent(*args):
...
@@ -32,22 +31,23 @@ 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
global
username_global
username
=
username_global
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Account successfully created for
'
+
username_global
)
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Account successfully created for
'
+
username
)
socketio
.
emit
(
"
account ready
"
,
room
=
room_global
)
socketio
.
emit
(
"
account ready
"
)
return
True
return
True
@socketio.on
(
'
user connected
'
)
@socketio.on
(
'
user connected
'
)
def
user_connected
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
def
user_connected
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
username
=
json
[
"
user
"
]
global
username_global
global
room_global
room
=
str
(
session
[
'
uid
'
])
username_global
=
json
[
"
user
"
]
room_global
=
str
(
session
[
'
uid
'
])
join_room
(
room
)
join_room
(
room
_global
)
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
_global
+
'
connected.
'
)
print
(
'
\t\t\t
|-----Room ID:
'
+
room
)
print
(
'
\t\t\t
|-----Room ID:
'
+
room
_global
)
@socketio.on
(
'
request account
'
)
@socketio.on
(
'
request account
'
)
...
@@ -59,9 +59,9 @@ def request_account(json, methods=['GET', 'POST']):
...
@@ -59,9 +59,9 @@ def request_account(json, methods=['GET', 'POST']):
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
"
)
socketio
.
emit
(
"
Account creation failed
"
,
room
=
room_global
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
# app.run()
# app.run()
socketio
.
run
(
app
)
socketio
.
run
(
app
,
host
=
'
0.0.0.0
'
)
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