Skip to content

Commit

Permalink
feat: Better identification in alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
figuernd committed May 16, 2024
1 parent cd6700e commit e760383
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phyto-arm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit e760383

Please sign in to comment.