Class: Swa::CLI::AthenaCommand::QueryCompletionWaiter

Inherits:
Object
  • Object
show all
Defined in:
lib/swa/cli/athena_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ QueryCompletionWaiter

Returns a new instance of QueryCompletionWaiter.



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/swa/cli/athena_command.rb', line 164

def initialize(options)
  @client = options.fetch(:client)
  @waiter = Aws::Waiters::Waiter.new({
    max_attempts: 30,
    delay: 5,
    poller: Aws::Waiters::Poller.new(
      operation_name: :get_query_execution,
      acceptors: [
        {
          "matcher" => "path",
          "argument" => "query_execution.status.state",
          "expected" => "SUCCEEDED",
          "state" => "success",
        },
        {
          "matcher" => "path",
          "argument" => "query_execution.status.state",
          "expected" => "FAILED",
          "state" => "failure",
        },
        {
          "matcher" => "path",
          "argument" => "query_execution.status.state",
          "expected" => "CANCELLED",
          "state" => "error",
        }
      ]
    )
  }.merge(options))
end

Instance Method Details

#wait(params = {}) ⇒ Object



195
196
197
# File 'lib/swa/cli/athena_command.rb', line 195

def wait(params = {})
  @waiter.wait(client: @client, params: params)
end