Method: Fluent::BigQuery::Writer#fetch_load_job

Defined in:
lib/fluent/plugin/bigquery/writer.rb

#fetch_load_job(job_reference) ⇒ Object



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/fluent/plugin/bigquery/writer.rb', line 175

def fetch_load_job(job_reference)
  project = job_reference.project_id
  job_id = job_reference.job_id
  location = @options[:location]

  res = client.get_job(project, job_id, location: location)
  log.debug "load job fetched", id: job_id, state: res.status.state, **job_reference.as_hash(:project_id, :dataset_id, :table_id)

  if res.status.state == "DONE"
    res
  end
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
  e = Fluent::BigQuery::Error.wrap(e) 
  raise e unless e.retryable?
end