Commit 13f7b75e authored by Mitchell Moore's avatar Mitchell Moore Committed by Krish Moodbidri
Browse files

Implemented celery ( to communicate with rabbitmq. Data sent to via

- Begin celery implementation and call
- Finish minor celery implementation
parent 390e1257
......@@ -3,8 +3,9 @@
import os
import time
import signal
import tasks
import pika
from flask import session
from flask_socketio import SocketIO, join_room
......@@ -55,7 +56,8 @@ def request_account(json, methods=['GET', 'POST']):
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
create_account(json['username'], json['fullname'], json['reason'])
# create_account(json['username'], json['fullname'], json['reason'])
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room_global, socketio)
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
from celery import Celery
import time
from flask_socketio import SocketIO
from gevent import monkey
celery = Celery('flask_user_reg', broker='amqp://')
# socketio = SocketIO(message_queue='amqp:///socketio')
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)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
socketio.emit('account ready', room=room)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment