Class: Retab::ExperimentRunResults

Inherits:
Object
  • Object
show all
Defined in:
lib/retab/experiment_run_results.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ExperimentRunResults

Returns a new instance of ExperimentRunResults.



9
10
11
# File 'lib/retab/experiment_run_results.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#get(result_id:, request_options: {}) ⇒ Retab::ExperimentResult

Get Experiment Result

Parameters:

  • result_id (String)
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/retab/experiment_run_results.rb', line 45

def get(
  result_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/workflows/experiments/results/#{Retab::Util.encode_path(result_id)}",
    auth: true,
    request_options: request_options
  )
  result = Retab::ExperimentResult.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#list(run_id:, limit: 100, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::ExperimentResult>

List Experiment Results

Parameters:

  • run_id (String)
  • limit (Integer, nil) (defaults to: 100)
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/retab/experiment_run_results.rb', line 18

def list(
  run_id:,
  limit: 100,
  request_options: {}
)
  params = {
    'run_id' => run_id,
    'limit' => limit
  }.compact
  response = @client.request(
    method: :get,
    path: '/v1/workflows/experiments/results',
    auth: true,
    params: params,
    request_options: request_options
  )
  Retab::Types::ListStruct.from_response(
    response,
    model: Retab::ExperimentResult,
    filters: { run_id: run_id, limit: limit }
  )
end