embulk-input-bigquery_extract_files 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ad9b4688bba442662baac2209f35077b14c669b
4
- data.tar.gz: 4b184864e80181b615cfef548ea065e6c2140a0d
3
+ metadata.gz: 23ea87433e2ed5453de192fc5ea73c4e1b7499b6
4
+ data.tar.gz: f28b4f9530974d7f2614392f951823af1213ed4a
5
5
  SHA512:
6
- metadata.gz: f6617b86ba4e1dff3cf2fb689c8b770b12a3c71598e5b2d68269037b456f18bb29a576f127bacdf3d088913912c6eb2f6f1305a19d17f66543ef5a769668f7bf
7
- data.tar.gz: c5394ab788b193dfc1920b508a715453ae30c40c1a629b3582ea8066778ee2ff965872b1a5b3f1cd2230892be958bb8a22fe79551481f958591ebb09abee90f1
6
+ metadata.gz: 54384d90f6fab9406c1d56aa4f8eff7fb3ed78aff8564bf910f8aa36610447bfc878e4f025a8a466e4e14afdca0457a5ca087e8cb62151744b786635179bfd8c
7
+ data.tar.gz: 775aff297708f182088b36ad48664d70ae0a4a411184ba6ae47cf719651c32b9ef582f3037b1d75d6dac7288511cc9420179d02d052553a50748f404bcbebda3
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.0.3"
16
+ version = "0.0.4"
17
17
 
18
18
  sourceCompatibility = 1.7
19
19
  targetCompatibility = 1.7
@@ -116,10 +116,13 @@ public class BigqueryExportGcsFileInputPlugin
116
116
  @ConfigDefault("null")
117
117
  public Optional<String> getTempSchemaFilePath();
118
118
 
119
- @Config("temp_schema_file_tpye")
119
+ @Config("temp_schema_file_type")
120
120
  @ConfigDefault("null")
121
121
  public Optional<String> getTempSchemaFileType();
122
122
 
123
+ @Config("bigquery_job_wait_second")
124
+ @ConfigDefault("600")
125
+ public Optional<Integer> getBigqueryJobWaitingSecond();
123
126
 
124
127
  @Config("cleanup_gcs_files")
125
128
  @ConfigDefault("false")
@@ -133,7 +133,7 @@ public class BigqueryExportUtils
133
133
  log.info("query to Table jobId : {}",jobId);
134
134
  log.info("waiting for job end....... ");
135
135
 
136
- Job lastJob = waitForJob(bigquery, task.getProject(), jobId);
136
+ Job lastJob = waitForJob(bigquery, task.getProject(), jobId, task.getBigqueryJobWaitingSecond().get());
137
137
 
138
138
  log.debug("waiting for job end....... {}", lastJob.toPrettyString());
139
139
  }
@@ -301,25 +301,31 @@ public class BigqueryExportUtils
301
301
  log.info("extract jobId : {}",jobId);
302
302
  log.debug("waiting for job end....... ");
303
303
 
304
- waitForJob(bigquery, task.getProject(), jobId);
304
+ waitForJob(bigquery, task.getProject(), jobId, task.getBigqueryJobWaitingSecond().get());
305
305
  return embulkSchema;
306
306
  }
307
307
 
308
- public static Job waitForJob(Bigquery bigquery, String project, String jobId) throws IOException, InterruptedException{
309
- int maxAttempts = 20;
308
+ public static Job waitForJob(Bigquery bigquery, String project, String jobId, int bigqueryJobWaitingSecond) throws IOException, InterruptedException{
309
+ int maxAttempts = bigqueryJobWaitingSecond;
310
310
  int initialRetryDelay = 1000; // ms
311
311
  Job pollingJob = null;
312
- for (int i=0; i < maxAttempts; i++){
312
+ log.info("waiting for job end : {}",jobId);
313
+ int tryCnt = 0;
314
+ for (tryCnt=0; tryCnt < maxAttempts; tryCnt++){
313
315
  pollingJob = bigquery.jobs().get(project, jobId).execute();
314
316
  String state = pollingJob.getStatus().getState();
315
317
  log.debug("Job Status {} : {}",jobId, state);
318
+
316
319
  if (pollingJob.getStatus().getState().equals("DONE")) {
317
320
  break;
318
321
  }
319
- log.debug("wait 1 second and waiting for end ...");
322
+ log.info("waiting {} ... ",tryCnt);
320
323
  Thread.sleep(initialRetryDelay);
321
-
322
324
  }
325
+ if(tryCnt + 1 == maxAttempts){
326
+ log.error("Bigquery Job Waiting exceed : over {} second...", bigqueryJobWaitingSecond);
327
+ }
328
+
323
329
  return pollingJob;
324
330
  }
325
331
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-bigquery_extract_files
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jo8937
@@ -64,7 +64,7 @@ files:
64
64
  - src/test/java/org/embulk/input/bigquery_export_gcs/UnitTestInitializer.java
65
65
  - classpath/commons-codec-1.3.jar
66
66
  - classpath/commons-logging-1.1.1.jar
67
- - classpath/embulk-input-bigquery_extract_files-0.0.3.jar
67
+ - classpath/embulk-input-bigquery_extract_files-0.0.4.jar
68
68
  - classpath/google-api-client-1.23.0.jar
69
69
  - classpath/google-api-services-bigquery-v2-rev363-1.23.0.jar
70
70
  - classpath/google-api-services-storage-v1-rev59-1.21.0.jar