def cancel( control_address: str, **kwargs, ): """ Cancel this runtime by sending a TERMINATE control message :param control_address: the address where the control message needs to be sent :param kwargs: extra keyword arguments """ try: Grpclet.send_ctrl_msg(control_address, 'TERMINATE') except RpcError: # TERMINATE can fail if the the runtime dies before sending the return value pass
def is_ready(ctrl_address: str, **kwargs) -> bool: """ Check if status is ready. :param ctrl_address: the address where the control message needs to be sent :param kwargs: extra keyword arguments :return: True if status is ready else False. """ try: response = Grpclet.send_ctrl_msg(ctrl_address, 'STATUS') except RpcError: return False return True
def send_status(): return Grpclet.send_ctrl_msg( pod_address=f'{args.host}:{args.port_in}', command='STATUS')