Improve TTY message, add colored text support
@@ -9,15 +9,39 @@ log = logging.getLogger(__name__)
class MessageSendingBehaviour():
def get_warning_message(self, data: Dict[str, Any]):
message_template = cleandoc(
- '''
+ '''{red_bg}{white_fg}
You are violating {owner_name}\'s reservation!
- Please, stop all your computations on {gpu_name} ({gpu_uuid}).
+ Please, stop all your computations immidiately.{reset}
+ {red_fg}{bold}
+ Host: {hostname}
+ Name: GPU{gpu_id}, {gpu_name}{reset}
+ UUID: {gpu_uuid}
+
+ Current reservation ends on {red_fg}{reservation_end}{reset}.
+
+ If this was by a mistake, please do not do this again.
+ Before starting any GPU-related computations, see TensorHive reservations calendar.
+ Please visit: {green_bg}http://cuda3:5000{reset}
+
+ Regards,
+ TensorHive bot
+ {reset}
''')
message = message_template.format(
owner_name=data['RESERVATION_OWNER_USERNAME'],
+ hostname=data['HOSTNAME'],
+ gpu_id=data['GPU_ID'],
gpu_name=data['GPU_NAME'],
- gpu_uuid=data['UUID'])
+ gpu_uuid=data['UUID'],
+ reservation_end=data['RESERVATION_END'],
+ white_fg='\e[97m',
+ red_fg='\e[31m',
+ light_red_fg='\e[101m',
+ red_bg='\e[41m',
+ green_bg='\e[42m',
+ bold='\e[1m',
+ reset='\e[0m')
return message
def _build_single_command(self, recipient: str, tty, msg: str) -> str:
