Class: Grpc::Client::ORiN3::Provider::ORiN3Job

Inherits:
ORiN3BaseObject show all
Includes:
ORiN3ResourceOpener
Defined in:
lib/grpc/client/orin3/provider/orin3_job.rb

Instance Attribute Summary collapse

Attributes inherited from ORiN3BaseObject

#name, #option, #orin3_object_type, #type_name

Instance Method Summary collapse

Methods included from ORiN3ResourceOpener

#close, #open

Methods inherited from ORiN3BaseObject

#execute, #get_status, #get_tag, #get_tag_keys, #id, #remove_tag, #set_tag

Constructor Details

#initialize(channel, internal_id, created_datetime) ⇒ ORiN3Job

Returns a new instance of ORiN3Job.



22
23
24
25
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 22

def initialize(channel, internal_id, created_datetime)
  @created_datetime = created_datetime
  super(channel, internal_id)
end

Instance Attribute Details

#created_datetimeObject (readonly)

Returns the value of attribute created_datetime.



19
20
21
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 19

def created_datetime
  @created_datetime
end

Instance Method Details

#get_resultObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 67

def get_result
  begin
    job = O3::JobService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::GetResultRequest.new(common: O3P::CommonRequest.new, id: @internal_id)
    response = job.get_result(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    response.is_null_result ? nil : ORiN3BinaryConverter.deserialize(response.result)
  rescue MessageClientError => ee
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end
end

#get_standard_errorObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 51

def get_standard_error
  begin
    job = O3::JobService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::GetStandardErrorRequest.new(common: O3P::CommonRequest.new, id: @internal_id)
    response = job.get_standard_error(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    response.error
  rescue MessageClientError => ee
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end
end

#get_standard_outputObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 35

def get_standard_output
  begin
    job = O3::JobService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::GetStandardOutputRequest.new(common: O3P::CommonRequest.new, id: @internal_id)
    response = job.get_standard_output(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    response.output
  rescue MessageClientError => ee
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end
end

#start(argument = nil) ⇒ Object



27
28
29
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 27

def start(argument = nil)
  open(argument.nil? ? {} : argument)
end

#stop(argument = nil) ⇒ Object



31
32
33
# File 'lib/grpc/client/orin3/provider/orin3_job.rb', line 31

def stop(argument = nil)
  close(argument.nil? ? {} : argument)
end