Class: Grpc::Client::ORiN3::RemoteEngine
- Inherits:
-
Object
- Object
- Grpc::Client::ORiN3::RemoteEngine
- Defined in:
- lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb
Instance Method Summary collapse
- #get_status ⇒ Object
-
#initialize(channel) ⇒ RemoteEngine
constructor
A new instance of RemoteEngine.
- #terminate_provider(id) ⇒ Object
- #wakeup_provider(id, version, host, port) ⇒ Object
Constructor Details
#initialize(channel) ⇒ RemoteEngine
Returns a new instance of RemoteEngine.
60 61 62 |
# File 'lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb', line 60 def initialize(channel) @channel = channel end |
Instance Method Details
#get_status ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb', line 64 def get_status begin service = O3::RemoteEngineService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel) request = O3::GetRemoteEngineStatusRequest.new(common: O3::CommonRequest.new) response = service.get_remote_engine_status(request) if (response.common.result_code != :SUCCEEDED) raise MessageClientError.new(response.common.result_code, response.common.detail) end return RemoteEngineStatus.new(response.common.result_code, response.status, response.instance_id, response.host, response.addresses, response.version, response.os_platform, response.os_description, response.running_provider_count) rescue MessageClientError raise rescue StandardError => e raise MessageClientError.new(e) end end |
#terminate_provider(id) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb', line 113 def terminate_provider(id) begin service = O3::RemoteEngineService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel) request = O3::TerminateProviderRequest.new(common: O3::CommonRequest.new, id: id) response = service.terminate_provider(request) if (response.common.result_code != :SUCCEEDED) raise MessageClientError.new(response.common.result_code, response.common.detail) end rescue MessageClientError raise rescue StandardError => e raise MessageClientError.new(e) end end |
#wakeup_provider(id, version, host, port) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/grpc/client/orin3/remoteengine/orin3_remote_engine.rb', line 82 def wakeup_provider(id, version, host, port) begin service = O3::RemoteEngineService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel) endpoint_info = create_provider_core_startup_argument_endpoint_info(0, host, port) telemetry_option = create_telemetry_option(true) argument = create_provider_core_startup_argument(false, [endpoint_info], 0, telemetry_option) request = O3::WakeupProviderRequest.new( common: O3::CommonRequest.new(reserved: 0), id: id, version: version, provider_startup_argument: argument) response = service.wakeup_provider(request) if (response.common.result_code != :SUCCEEDED) raise MessageClientError.new(response.common.result_code, response.common.detail) end endpoints = response.provider_information.endpoints.map do |endpoint| ProviderEndpoint.new( endpoint.index, endpoint.ip_address, endpoint.port, endpoint.uri, endpoint.protocol_type ) end return WakeupProviderResponse.new(response.id, ProviderInformation.new(endpoints)) rescue MessageClientError raise rescue StandardError => e raise MessageClientError.new(e) end end |