Skip to content
Snippets Groups Projects

Feat rc_util add function

Closed Bo-Chun Chen requested to merge github/fork/diedpigs/feat-util-add-function into develop
1 file
+ 4
2
Compare changes
  • Side-by-side
  • Inline
+ 4
2
@@ -2,6 +2,7 @@ from rc_rmq import RCRMQ
@@ -2,6 +2,7 @@ from rc_rmq import RCRMQ
import json
import json
rc_rmq = RCRMQ({'exchange': 'Request'})
rc_rmq = RCRMQ({'exchange': 'Request'})
 
confirm_rmq = RCRMQ({'exchange': 'Confirm'})
tasks = {'ohpc_account': False, 'ohpc_homedir': False, 'ood_account': False, 'slurm_account': False}
tasks = {'ohpc_account': False, 'ohpc_homedir': False, 'ood_account': False, 'slurm_account': False}
def add_account(username, full='', reason=''):
def add_account(username, full='', reason=''):
@@ -28,13 +29,14 @@ def worker(ch, method, properties, body):
@@ -28,13 +29,14 @@ def worker(ch, method, properties, body):
if not status:
if not status:
done = False
done = False
if done:
if done:
rc_rmq.stop_consume()
confirm_rmq.stop_consume()
 
confirm_rmq.delete_queue()
def consume(username, worker, debug=False):
def consume(username, worker, debug=False):
if debug:
if debug:
sleep(5)
sleep(5)
else:
else:
rc_rmq.start_consume({
confirm_rmq.start_consume({
'queue': username,
'queue': username,
'cb': worker
'cb': worker
})
})
Loading