Skip to content
Snippets Groups Projects
Commit 9a95c611 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Move message define to the top

parent 51e5bfe3
No related branches found
No related tags found
6 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!78Feat cod rmq,!62Feat notify user errmsg,!63Feat db handle,!55task manager fail handling
...@@ -103,6 +103,16 @@ def task_manager(ch, method, properties, body): ...@@ -103,6 +103,16 @@ def task_manager(ch, method, properties, body):
if errmsg: if errmsg:
current['errmsg'].append(f"{task_name}: {errmsg}") current['errmsg'].append(f"{task_name}: {errmsg}")
# Define message that's going to be published
message = {
'username': username,
'uid': current['uid'],
'gid': current['gid'],
'email': current['email'],
'reason': current['reason'],
'fullname': current['fullname']
}
try: try:
if task_name in current['request']: if task_name in current['request']:
current['request'][task_name] = success current['request'][task_name] = success
...@@ -147,14 +157,7 @@ def task_manager(ch, method, properties, body): ...@@ -147,14 +157,7 @@ def task_manager(ch, method, properties, body):
# Send trigger message # Send trigger message
rc_rmq.publish_msg({ rc_rmq.publish_msg({
'routing_key': routing_key, 'routing_key': routing_key,
'msg': { 'msg': message
'username': username,
'fullname': current['fullname'],
'email': current['email'],
'uid': current['uid'],
'gid': current['gid'],
'reason': current['reason']
}
}) })
logger.debug(f"Trigger message '{routing_key}' sent") logger.debug(f"Trigger message '{routing_key}' sent")
......
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