Class: Arvados::ArvadosClient

Inherits:
Google::APIClient
  • Object
show all
Defined in:
lib/arvados.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#request_idObject (readonly)

Returns the value of attribute request_id.



21
22
23
# File 'lib/arvados.rb', line 21

def request_id
  @request_id
end

Instance Method Details

#execute(*args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/arvados.rb', line 23

def execute(*args)
  @request_id = "req-" + Random.new.rand(2**128).to_s(36)[0..19]
  if args.last.is_a? Hash
    args.last[:headers] ||= {}
    args.last[:headers]['X-Request-Id'] = @request_id
  end
  begin
    super(*args)
  rescue => e
    if !e.message.match(/.*req-[0-9a-zA-Z]{20}.*/)
      raise $!, "#{$!} (Request ID: #{@request_id})", $!.backtrace
    end
    raise e
  end
end