diff --git a/run.py b/run.py index be07de40b987e45cf6e1582ac93fbfad960dcce7..6c3e8d6eb6f1a1898fbc61235d7b7db56482ab49 100644 --- a/run.py +++ b/run.py @@ -5,7 +5,6 @@ import time import signal import tasks - from flask import session from flask_socketio import SocketIO, join_room @@ -14,8 +13,9 @@ from app import create_app config_name = os.getenv('FLASK_CONFIG') app = create_app(config_name) app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#' +socketio = SocketIO(app, message_queue='amqp://reggie:reggie@ohpc:5672/socketio') +#socketio = SocketIO(app) #socketio = SocketIO(app, message_queue='amqp:///socketio') -socketio = SocketIO(app) # global username_global # global room_global @@ -55,13 +55,15 @@ def user_connected(json, methods=['GET', 'POST']): @socketio.on('request account') def request_account(json, methods=['GET', 'POST']): print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json)) - print(json) + #print(json) room = str(session['uid']) + join_room(room) + print("Room: {}".format(room)) #socketio.emit("creating account") try: # create_account(json['username'], json['fullname'], json['reason']) - tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room, socketio) - + #tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], room, socketio, session=room) + tasks.celery_create_account.delay(json['username'], json['fullname'], json['reason'], room) except Exception as e: print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e) socketio.emit("Account creation failed", room)