Class: Retab::WorkflowBlockExecutions

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WorkflowBlockExecutions

Returns a new instance of WorkflowBlockExecutions.



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

def initialize(client)
  @client = client
end

Instance Method Details

#create(run_id:, block_id:, step_id: nil, n_consensus: nil, check_eligibility: nil, request_options: {}) ⇒ Retab::StoredBlockExecution

Create Block Execution

Parameters:

  • run_id (String)

    Workflow run id that owns the step.

  • block_id (String)

    Workflow block id to execute.

  • step_id (String, nil) (defaults to: nil)

    Optional concrete step id whose inputs should be used. When omitted, the block id is used as the canonical step lookup key.

  • n_consensus (Integer, nil) (defaults to: nil)

    Optional override for n_consensus on extract / split / classifier blocks. Must be 3, 5, or 7.

  • check_eligibility (Boolean, nil) (defaults to: nil)

    Whether to verify the upstream subgraph hasn’t drifted since the source run. Disable only for explicit force-rerun flows.

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

    (see Retab::Types::RequestOptions)

Returns:



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
# File 'lib/retab/workflow_block_executions.rb', line 52

def create(
  run_id:,
  block_id:,
  step_id: nil,
  n_consensus: nil,
  check_eligibility: nil,
  request_options: {}
)
  body = {
    'run_id' => run_id,
    'block_id' => block_id,
    'step_id' => step_id,
    'n_consensus' => n_consensus,
    'check_eligibility' => check_eligibility
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/workflows/blocks/executions',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Retab::StoredBlockExecution.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:, block_id:, limit: 20, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::StoredBlockExecution>

List Block Executions

Parameters:

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

    (see Retab::Types::RequestOptions)

Returns:



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

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