From e7603831ff64ea09a4118206f4f216be9e075d48 Mon Sep 17 00:00:00 2001 From: Nathan Figueroa Date: Wed, 15 May 2024 23:07:50 -0400 Subject: [PATCH] feat: Better identification in alerts --- phyto-arm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phyto-arm b/phyto-arm index 7ac27b7..d6eee92 100755 --- a/phyto-arm +++ b/phyto-arm @@ -83,13 +83,13 @@ def prep_roslaunch(config, env, package, launchfile): # Send alerts when the program stops -def send_alerts(alert_config, launch_name): +def send_alerts(alert_config, deployment, launch_name): for alert in alert_config: assert alert['type'] == 'slack' and alert['url'] urllib.request.urlopen( alert['url'], json.dumps({ - 'text': f'PhytO-ARM {launch_name} stopped' + 'text': f'*PhytO-ARM process stopped*\n - Deployment: _{deployment}_ \n - Process: _{launch_name}_' }).encode() ) @@ -137,7 +137,7 @@ def _start(args): print(f'{name} ({proc.pid}) eventually exited') # Set up alerts for when we terminate - atexit.register(send_alerts, config.get('alerts', []), args.launch_name) + atexit.register(send_alerts, config.get('alerts', []), config.get('name'), args.launch_name) # Allow the config to override where logs are stored log_dir = config.get('launch_args', {}).get('log_dir')