Skip to content
Snippets Groups Projects
Commit b7b2a44c authored by Cloud User's avatar Cloud User
Browse files

Adding a process to start account creation process by calling flask_producer script

parent f197dbb2
No related branches found
No related tags found
No related merge requests found
from celery import Celery
import time
from flask_socketio import SocketIO
import subprocess
from gevent import monkey
monkey.patch_all(subprocess=True)
celery = Celery('flask_user_reg', broker='amqp://')
broker_url = 'amqp://reggie:reggie@ohpc:5672/'
#broker_url = 'amqp://'
celery = Celery('flask_user_reg', broker=broker_url)
# socketio = SocketIO(message_queue='amqp:///socketio')
......@@ -14,6 +18,8 @@ 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(username)
subprocess.call(["/opt/rabbitmq_agents/flask_producer.py", "ohpc_account_create", username])
time.sleep(5)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
socketio.emit('account ready', room=room)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment