diff --git a/rc_util.py b/rc_util.py index 63acbbe37dcf2f2a1700ac98793a52a010d8e34e..3fb55fddcb35082065646d99354d31144d94b869 100644 --- a/rc_util.py +++ b/rc_util.py @@ -1,13 +1,12 @@ from rc_rmq import RCRMQ import json -rc_rmq = RCRMQ({'exchange': 'Register'}) -confirm_rmq = RCRMQ({'exchange': 'Confirm'}) -tasks = {'ohpc_account': False, 'ohpc_homedir': False, 'ood_account': False, 'slurm_account': False} +rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'}) +tasks = {'ohpc_account': None, 'ood_account': None, 'slurm_account': None} def add_account(username, full='', reason=''): rc_rmq.publish_msg({ - 'routing_key': 'ohpc_account', + 'routing_key': 'request.' + username, 'msg': { "username": username, "fullname": full, @@ -18,8 +17,8 @@ def add_account(username, full='', reason=''): def worker(ch, method, properties, body): msg = json.loads(body) task = msg['task'] - print("get msg: {}".format(task)) tasks[task] = msg['success'] + print("Got msg: {}({})".format(msg['task'], msg['success'])) # Check if all tasks are done done = True @@ -37,6 +36,7 @@ def consume(username, callback, debug=False): else: confirm_rmq.start_consume({ 'queue': username, + 'routing_key': 'confirm.' + username, 'cb': callback })