From 3621d57db1cfadd0a8eb7aac16bd607fd0d913c7 Mon Sep 17 00:00:00 2001 From: Krish Moodbidri <krish94@uab.edu> Date: Fri, 28 Feb 2020 10:15:09 -0600 Subject: [PATCH] testing celery message passign --- app/templates/auth/SignUp.html | 2 +- run.py | 3 ++- tasks.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/templates/auth/SignUp.html b/app/templates/auth/SignUp.html index 44bff77..fbd03d3 100644 --- a/app/templates/auth/SignUp.html +++ b/app/templates/auth/SignUp.html @@ -105,7 +105,7 @@ <input class="form-control" id="fullname" name="fullname" placeholder="Enter Full Name" required="" type="text"> <label><b><label for="reason">Reason for Requesting Account: </label><br></b></label> <textarea class="form-control" id="reason" name="reason" placeholder="Enter Reason for Account Request" required=""></textarea> - <input class="btn btn-primary btn-block" id="submit" name="submit" type="button" value="Submit" onclick="request_account()"> + <input class="btn btn-primary btn-block" id="submit" name="submit" type="button" value="Submit" onclick="displayloading();request_account()"> <div> <strong id="error" style="color: #be051b; text-align: center;"></strong> diff --git a/run.py b/run.py index ea80ec7..71bceb0 100644 --- a/run.py +++ b/run.py @@ -31,7 +31,7 @@ def user_connected(json, methods=['GET', 'POST']): @socketio.on('request account') def request_account(json, methods=['GET', 'POST']): - socketio.emit("creating account") + print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json)) room = str(session['uid']) @@ -39,6 +39,7 @@ def request_account(json, methods=['GET', 'POST']): try: + socketio.emit("creating account") #create_account(json['username'], json['fullname'], json['reason']) tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room, socketio) diff --git a/tasks.py b/tasks.py index b19f450..827d519 100644 --- a/tasks.py +++ b/tasks.py @@ -11,9 +11,9 @@ celery = Celery('flask_user_reg', broker='amqp://') @celery.task def celery_create_account(username, fullname, reason, room, socketio): - # Todo: Ravi's and Louis's code goes here + print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue') #socketio.emit("creating account", room=room) - time.sleep(5) + time.sleep(10) print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username) socketio.emit('account ready', room=room) -- GitLab