Class: Retab::ExperimentRuns
- Inherits:
-
Object
- Object
- Retab::ExperimentRuns
- Defined in:
- lib/retab/experiment_runs.rb
Instance Method Summary collapse
-
#cancel(run_id:, request_options: {}) ⇒ Retab::CancelWorkflowExperimentRunResponse
Cancel Experiment Run.
-
#create(experiment_id:, workflow_id: nil, request_options: {}) ⇒ Retab::ExperimentRun
Create Experiment Run Flat.
-
#get(run_id:, request_options: {}) ⇒ Retab::ExperimentRun
Get Experiment Run.
-
#initialize(client) ⇒ ExperimentRuns
constructor
A new instance of ExperimentRuns.
-
#list(workflow_id: nil, experiment_id: nil, block_id: nil, status: nil, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: nil, from_date: nil, to_date: nil, sort_by: 'created_at', fields: nil, before: nil, after: nil, limit: 20, order: 'desc', request_options: {}) ⇒ Retab::Types::ListStruct<Retab::ExperimentRun>
List Experiment Runs.
Constructor Details
#initialize(client) ⇒ ExperimentRuns
Returns a new instance of ExperimentRuns.
9 10 11 |
# File 'lib/retab/experiment_runs.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#cancel(run_id:, request_options: {}) ⇒ Retab::CancelWorkflowExperimentRunResponse
Cancel Experiment Run
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/retab/experiment_runs.rb', line 154 def cancel( run_id:, request_options: {} ) response = @client.request( method: :post, path: "/v1/workflows/experiments/runs/#{Retab::Util.encode_path(run_id)}/cancel", auth: true, request_options: ) result = Retab::CancelWorkflowExperimentRunResponse.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 |
#create(experiment_id:, workflow_id: nil, request_options: {}) ⇒ Retab::ExperimentRun
Create Experiment Run Flat
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/retab/experiment_runs.rb', line 110 def create( experiment_id:, workflow_id: nil, request_options: {} ) body = { 'experiment_id' => experiment_id, 'workflow_id' => workflow_id }.compact response = @client.request( method: :post, path: '/v1/workflows/experiments/runs', auth: true, body: body, request_options: ) result = Retab::ExperimentRun.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 |
#get(run_id:, request_options: {}) ⇒ Retab::ExperimentRun
Get Experiment Run
135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/retab/experiment_runs.rb', line 135 def get( run_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/experiments/runs/#{Retab::Util.encode_path(run_id)}", auth: true, request_options: ) result = Retab::ExperimentRun.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(workflow_id: nil, experiment_id: nil, block_id: nil, status: nil, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: nil, from_date: nil, to_date: nil, sort_by: 'created_at', fields: nil, before: nil, after: nil, limit: 20, order: 'desc', request_options: {}) ⇒ Retab::Types::ListStruct<Retab::ExperimentRun>
List Experiment Runs
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/retab/experiment_runs.rb', line 32 def list( workflow_id: nil, experiment_id: nil, block_id: nil, status: nil, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: nil, from_date: nil, to_date: nil, sort_by: 'created_at', fields: nil, before: nil, after: nil, limit: 20, order: 'desc', request_options: {} ) params = { 'workflow_id' => workflow_id, 'experiment_id' => experiment_id, 'block_id' => block_id, 'status' => status, 'statuses' => statuses, 'exclude_status' => exclude_status, 'trigger_type' => trigger_type, 'trigger_types' => trigger_types, 'from_date' => from_date, 'to_date' => to_date, 'sort_by' => sort_by, 'fields' => fields, 'before' => before, 'after' => after, 'limit' => limit, 'order' => order }.compact response = @client.request( method: :get, path: '/v1/workflows/experiments/runs', auth: true, params: params, request_options: ) fetch_next = ->(cursor) { list( workflow_id: workflow_id, experiment_id: experiment_id, block_id: block_id, status: status, statuses: statuses, exclude_status: exclude_status, trigger_type: trigger_type, trigger_types: trigger_types, from_date: from_date, to_date: to_date, sort_by: sort_by, fields: fields, before: before, after: cursor, limit: limit, order: order, request_options: ) } Retab::Types::ListStruct.from_response( response, model: Retab::ExperimentRun, filters: { workflow_id: workflow_id, experiment_id: experiment_id, block_id: block_id, status: status, statuses: statuses, exclude_status: exclude_status, trigger_type: trigger_type, trigger_types: trigger_types, from_date: from_date, to_date: to_date, sort_by: sort_by, fields: fields, before: before, limit: limit, order: order }, fetch_next: fetch_next ) end |