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.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/swa/cli/athena_command.rb', line 174

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



205
206
207
# File 'lib/swa/cli/athena_command.rb', line 205

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