bricolage 5.27.2 → 5.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +22 -0
  3. data/Gemfile +2 -0
  4. data/LICENSES +21 -0
  5. data/RELEASE.md +271 -0
  6. data/Rakefile +3 -0
  7. data/bricolage.gemspec +26 -0
  8. data/jobclass/exec.rb +5 -2
  9. data/lib/bricolage/configloader.rb +12 -10
  10. data/lib/bricolage/datasource.rb +16 -11
  11. data/lib/bricolage/job.rb +3 -0
  12. data/lib/bricolage/jobfile.rb +42 -6
  13. data/lib/bricolage/parameters.rb +6 -2
  14. data/lib/bricolage/version.rb +1 -1
  15. data/streaming_load_log.ct +9 -0
  16. metadata +11 -143
  17. data/test/all.rb +0 -3
  18. data/test/home/Gemfile +0 -3
  19. data/test/home/Gemfile.lock +0 -44
  20. data/test/home/config/bricolage.yml +0 -1
  21. data/test/home/config/development/database.yml +0 -100
  22. data/test/home/config/development/password.yml +0 -6
  23. data/test/home/config/development/variable.yml +0 -7
  24. data/test/home/data/20141002-1355_00.txt +0 -2
  25. data/test/home/data/20141002-1355_01.txt +0 -2
  26. data/test/home/data/20141002-1355_02.txt +0 -2
  27. data/test/home/data/test.txt +0 -1
  28. data/test/home/jobnet-test.rb +0 -61
  29. data/test/home/log/20170117/subsys::job1/20170117_202014082/subsys-job1.log +0 -3
  30. data/test/home/log/20170117/subsys::job1/20170117_202334852/subsys-job1.log +0 -3
  31. data/test/home/log/20170117/subsys::job1/20170117_202405056/subsys-job1.log +0 -3
  32. data/test/home/log/20170117/subsys::migrate/20170117_202548409/subsys-migrate.log +0 -80
  33. data/test/home/log/20170117/subsys::migrate/20170117_202636115/subsys-migrate.log +0 -79
  34. data/test/home/log/20170117/subsys::net1/20170117_203022461/subsys-job1.log +0 -3
  35. data/test/home/log/20170117/subsys::net1/20170117_203022461/subsys-job2.log +0 -3
  36. data/test/home/log/20170117/subsys::net1/20170117_203022461/subsys-job3.log +0 -3
  37. data/test/home/log/20170117/subsys::net1/20170117_203022461/subsys-job4.log +0 -3
  38. data/test/home/log/20170117/subsys::net1/20170117_203102130/subsys-job1.log +0 -3
  39. data/test/home/log/20170117/subsys::net1/20170117_203102130/subsys-job2.log +0 -3
  40. data/test/home/log/20170117/subsys::net1/20170117_203102130/subsys-job3.log +0 -3
  41. data/test/home/log/20170117/subsys::net1/20170117_203102130/subsys-job4.log +0 -3
  42. data/test/home/log/20170117/subsys::net1/20170117_203232033/subsys-job1.log +0 -3
  43. data/test/home/log/20170117/subsys::net1/20170117_203232033/subsys-job2.log +0 -3
  44. data/test/home/log/20170117/subsys::net1/20170117_203232033/subsys-job3.log +0 -3
  45. data/test/home/log/20170117/subsys::net1/20170117_203232033/subsys-job4.log +0 -3
  46. data/test/home/log/20170629/subsys::job1/20170629_155543985/subsys-job1.log +0 -3
  47. data/test/home/log/20170629/subsys::net1/20170629_154308811/subsys-job1.log +0 -3
  48. data/test/home/log/20170629/subsys::net1/20170629_154308811/subsys-job2.log +0 -3
  49. data/test/home/log/20170629/subsys::net1/20170629_154308811/subsys-job3.log +0 -3
  50. data/test/home/log/20170629/subsys::net1/20170629_154308811/subsys-job4.log +0 -3
  51. data/test/home/log/20170629/subsys::net1/20170629_155330208/subsys-job1.log +0 -3
  52. data/test/home/log/20170629/subsys::net1/20170629_155330208/subsys-job2.log +0 -3
  53. data/test/home/log/20170629/subsys::net1/20170629_155330208/subsys-job3.log +0 -3
  54. data/test/home/log/20170629/subsys::net1/20170629_155330208/subsys-job4.log +0 -3
  55. data/test/home/log/20170630/subsys::net1/20170630_145523511/subsys-job1.log +0 -3
  56. data/test/home/log/20170630/subsys::net1/20170630_145523511/subsys-job2.log +0 -3
  57. data/test/home/log/20170630/subsys::net1/20170630_145523511/subsys-job3.log +0 -3
  58. data/test/home/log/20170630/subsys::net1/20170630_145523511/subsys-job4.log +0 -3
  59. data/test/home/log/20170630/subsys::net1/20170630_145545097/subsys-job1.log +0 -3
  60. data/test/home/log/20170630/subsys::net1/20170630_145545097/subsys-job2.log +0 -3
  61. data/test/home/log/20170630/subsys::net1/20170630_145545097/subsys-job3.log +0 -3
  62. data/test/home/log/20170630/subsys::net1/20170630_145545097/subsys-job4.log +0 -3
  63. data/test/home/log/20170630/subsys::net1/20170630_145615702/subsys-job1.log +0 -3
  64. data/test/home/log/20170630/subsys::net1/20170630_145615702/subsys-job2.log +0 -3
  65. data/test/home/log/20170630/subsys::net1/20170630_145615702/subsys-job3.log +0 -3
  66. data/test/home/log/20170630/subsys::net1/20170630_145615702/subsys-job4.log +0 -3
  67. data/test/home/log/20170630/subsys::net1/20170630_153437221/subsys-job1.log +0 -3
  68. data/test/home/log/20170630/subsys::net1/20170630_153507519/subsys-job1.log +0 -3
  69. data/test/home/log/20170630/subsys::net1/20170630_153507519/subsys-job2.log +0 -3
  70. data/test/home/log/20170630/subsys::net1/20170630_153507519/subsys-job3.log +0 -3
  71. data/test/home/log/20170630/subsys::net1/20170630_153507519/subsys-job4.log +0 -3
  72. data/test/home/log/20170704/subsys::insert/20170704_164335210/subsys-insert.log +0 -14
  73. data/test/home/log/20170704/subsys::insert/20170704_164344251/subsys-insert.log +0 -14
  74. data/test/home/log/20170704/subsys::insert/20170704_164723299/subsys-insert.log +0 -14
  75. data/test/home/log/20170704/subsys::insert.sql/20170704_164143661/subsys-insert.sql.log +0 -14
  76. data/test/home/log/20170704/subsys::insert.sql.job/20170704_163033119/subsys-insert.log +0 -14
  77. data/test/home/log/20170704/subsys::insert.sql.job/20170704_172410576/subsys-insert.log +0 -14
  78. data/test/home/log/20170704/subsys::insert.sql.job/20170704_173130175/subsys-insert.log +0 -14
  79. data/test/home/log/20170704/subsys::insert.sql.job/20170704_173201376/subsys-insert.log +0 -14
  80. data/test/home/log/20170704/subsys::net1/20170704_162457694/subsys-job1.log +0 -3
  81. data/test/home/log/20170704/subsys::net1/20170704_162544282/subsys-job1.log +0 -3
  82. data/test/home/log/20170704/subsys::net1/20170704_162544282/subsys-job2.log +0 -3
  83. data/test/home/log/20170704/subsys::net1/20170704_162544282/subsys-job3.log +0 -3
  84. data/test/home/log/20170704/subsys::net1/20170704_162544282/subsys-job4.log +0 -3
  85. data/test/home/log/20170706/subsys::net1/20170706_201157129/subsys-job1.log +0 -3
  86. data/test/home/log/20170706/subsys::net1/20170706_201157129/subsys-job2.log +0 -3
  87. data/test/home/log/20170706/subsys::net1/20170706_201157129/subsys-job3.log +0 -3
  88. data/test/home/log/20170706/subsys::net1/20170706_201157129/subsys-job4.log +0 -3
  89. data/test/home/log/20170707/subsys::insert/20170707_020050817/subsys-insert.log +0 -51
  90. data/test/home/log/20170707/subsys::insert/20170707_020050817/subsys-insert.log.status +0 -1
  91. data/test/home/log/20170707/subsys::job1/20170707_020542902/subsys-job1.log +0 -3
  92. data/test/home/log/20170707/subsys::net1/20170707_012252058/subsys-job1.log +0 -3
  93. data/test/home/log/20170707/subsys::net1/20170707_012252058/subsys-job2.log +0 -3
  94. data/test/home/log/20170707/subsys::net1/20170707_012252058/subsys-job3.log +0 -3
  95. data/test/home/log/20170707/subsys::net1/20170707_012252058/subsys-job4.log +0 -3
  96. data/test/home/log/20170707/subsys::net1/20170707_020039222/subsys-job1.log +0 -3
  97. data/test/home/log/20170707/subsys::net1/20170707_020039222/subsys-job2.log +0 -3
  98. data/test/home/log/20170707/subsys::net1/20170707_020039222/subsys-job3.log +0 -3
  99. data/test/home/log/20170707/subsys::net1/20170707_020039222/subsys-job4.log +0 -3
  100. data/test/home/revert.sh +0 -7
  101. data/test/home/s +0 -1
  102. data/test/home/subsys/d.ct +0 -7
  103. data/test/home/subsys/insert.sql.job +0 -7
  104. data/test/home/subsys/item_pv_acc.ct +0 -8
  105. data/test/home/subsys/job1.job +0 -1
  106. data/test/home/subsys/job2.job +0 -1
  107. data/test/home/subsys/job3.job +0 -1
  108. data/test/home/subsys/job4.job +0 -1
  109. data/test/home/subsys/job5.job +0 -1
  110. data/test/home/subsys/job6.job +0 -1
  111. data/test/home/subsys/job7.job +0 -1
  112. data/test/home/subsys/load.job +0 -9
  113. data/test/home/subsys/load_test.ct +0 -6
  114. data/test/home/subsys/load_test.job +0 -14
  115. data/test/home/subsys/migrate.job +0 -33
  116. data/test/home/subsys/my-import-delta.sql.job +0 -40
  117. data/test/home/subsys/my-import.job +0 -31
  118. data/test/home/subsys/net1.jobnet +0 -3
  119. data/test/home/subsys/net2.jobnet +0 -2
  120. data/test/home/subsys/put.job +0 -3
  121. data/test/home/subsys/raw-vacuum.jobnet +0 -1
  122. data/test/home/subsys/raw-vacuum.sql.job +0 -7
  123. data/test/home/subsys/rebuild.sql.job +0 -14
  124. data/test/home/subsys/redis_export.job +0 -9
  125. data/test/home/subsys/redis_export2.job +0 -8
  126. data/test/home/subsys/search_backends.ct +0 -13
  127. data/test/home/subsys/separated.job +0 -1
  128. data/test/home/subsys/separated.sql +0 -1
  129. data/test/home/subsys/some_view-cv.sql.job +0 -11
  130. data/test/home/subsys/unified.jobnet +0 -1
  131. data/test/home/subsys/unified.sql.job +0 -5
  132. data/test/home/subsys/users.ct +0 -13
  133. data/test/home/subsys/variable.yml +0 -6
  134. data/test/test_c_streaming_load.rb +0 -13
  135. data/test/test_filesystem.rb +0 -19
  136. data/test/test_logfilepath.rb +0 -19
  137. data/test/test_parameters.rb +0 -401
  138. data/test/test_psqldatasource.rb +0 -12
  139. data/test/test_s3datasource.rb +0 -40
  140. data/test/test_variables.rb +0 -114
  141. data/test/vacuum-test.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b910f08fd3e77241f8ac067c9f129f2b33a7b98bcd1d017a72149fbf228fa8a
4
- data.tar.gz: 91f21bf4953bfbf1299df94700db1c7adf49000cb724b338da5a9b09e92da17e
3
+ metadata.gz: a3d6d789d6f3c437f1e3e9df962f92db5c7aac168952d633b72be38023d875c1
4
+ data.tar.gz: adbca861a3b9f811a22338422167f8945ba3d3894bfde294875ccb22c38e1a80
5
5
  SHA512:
6
- metadata.gz: a80f093c8db79a91b1d10419b29a00043ec1f54893654365e4b8c7c7bae421ced67a1516ddb0bc69cd30e9426611be3e0c6480d1f819add3973689789ffd5154
7
- data.tar.gz: 48861ccd45aff5c927e9b2f51587ac13e97b4c62a15de51d8ff181d38f1a606ed3e15c0dbc27259bc0010f554844aa0831864cc08ff20e39cdc1c99e144603e4
6
+ metadata.gz: 88a618757a3747efc8e846bb217c382044348b56f64e7f02c67f0e9e64c08fe56534ed4b282542a6639b07417dad40ac4c0a0afe78b14a273944c12d15ec1abf
7
+ data.tar.gz: a2ee05a0200bd069ff057b98d2bac2640d2dc9f2a984f90f50f844ebab07097961877038c3a7627f8d2adf641ca5b75c24ede6c5f024e959980782e8b7ebc63e
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ /dev
21
+ /test/home/config
22
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSES ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015-2018 Minero Aoki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/RELEASE.md ADDED
@@ -0,0 +1,271 @@
1
+ # Bricolage Release Note
2
+
3
+ ## version 5.28.0
4
+
5
+ - [new] bricolage command now accepts .rb.job, .py.job, .sh.job as a script-embedded job.
6
+ - [new] new data sources file "datasource.yml", in addition to database.yml. Users can continue to use database.yml, this does NOT introduce any incompatibility.
7
+ - [new] exec: New option "env" to set additional environment variables.
8
+ - [new] exec: Accepts single string value for args.
9
+
10
+ ## version 5.27.2
11
+
12
+ - [fix] Supports `encoding` load option.
13
+
14
+ ## version 5.27.1
15
+
16
+ - [fix] SNS data source did not work.
17
+
18
+ ## version 5.27.0
19
+
20
+ - [new] New option --disable-queue, to disable job queue explicitly. This option overrides enable-queue option in bricolage.yml.
21
+ - [new] New option --clear-queue, to clear job queue.
22
+
23
+ ## version 5.26.0
24
+
25
+ - [CHANGE] MySQL or Redis related job classes are separated into other gems, bricolage-mysql and bricolage-redis.
26
+ Use those gems if you need them.
27
+
28
+ ## version 5.25.1
29
+
30
+ - [fix] Adds dependency to aws-sdk-sns.
31
+
32
+ ## version 5.25.0
33
+
34
+ - Upgrade aws-sdk to v3 (aws-sdk-s3 v1).
35
+
36
+ ## version 5.24.6
37
+
38
+ - [fix] __FILE__ or __dir__ was not correct in config/prelude.rb.
39
+
40
+ ## version 5.24.5
41
+
42
+ - (skipped)
43
+
44
+ ## version 5.24.4
45
+
46
+ - Improve error message with my-import job failure
47
+
48
+ ## version 5.24.3
49
+
50
+ - Support ECS task role with my-import job class
51
+
52
+ ## version 5.24.2
53
+
54
+ - [fix] --log-dir, --log-path and --s3-log options are wrongly not ommittable
55
+
56
+ ## version 5.24.1
57
+
58
+ - [fix] --enable-queue did not work
59
+
60
+ ## version 5.24.0
61
+
62
+ - [new] New config file config/bricolage.yml to save command line options in the file.
63
+ - [new] New option --s3-log to upload log files to S3.
64
+ - [fix] Strips ".sql" from job ID, when the job is executed via *.sql.job file.
65
+ - [fix] Strips all file extensions from jobnet ID, including ".job" or ".sql.job".
66
+
67
+ ## version 5.23.3
68
+
69
+ - [fix] mys3dump creates empty object even though if source table has no records.
70
+
71
+ ## version 5.23.2
72
+
73
+ - [new] new job class: adhoc.
74
+ This job class have only one parameter, sql-file, so instance jobs are never affected by
75
+ defaults value such as analyze or grant.
76
+
77
+ ## version 5.23.1
78
+
79
+ - [new] streaming_load: new option --skip-work
80
+
81
+ ## version 5.23.0
82
+
83
+ - [CHANGE] Drops TD data source support from core. Use separated bricolage-td gem.
84
+
85
+ ## version 5.22.3
86
+
87
+ - [new] load, insert: Reduces the number of transactions.
88
+
89
+ ## version 5.22.2
90
+
91
+ - [new] new option -Q, -L
92
+
93
+ ## version 5.22.1
94
+
95
+ - [new] bricolage-jobnet: new options --enable-queue and --local-state-dir, for auto-named job queue.
96
+
97
+ ## version 5.22.0
98
+
99
+ - [new] bricolage: new option --log-path.
100
+ - [new] bricolage, bricolage-jobnet: new option --log-dir.
101
+ - [new] bricolage, bricolage-jobnet: new env BRICOLAGE_LOG_PATH.
102
+ - [new] bricolage, bricolage-jobnet: new env BRICOLAGE_LOG_DIR.
103
+
104
+ ## version 5.21.0
105
+
106
+ - [new] bricolage-jobnet command accepts .job file as a single job jobnet.
107
+
108
+ ## version 5.20.5
109
+
110
+ - [fix] my-migrate, my-import: Do not exposure passwords in command line arguments or log files.
111
+
112
+ ## version 5.20.4
113
+
114
+ - [fix] my-migrate, my-import: should not drop old tables in the RENAME transaction, to avoid "table dropped by concurrent transaction" error.
115
+
116
+ ## version 5.20.3
117
+
118
+ - [new] mysql data source: new option "collation".
119
+
120
+ ## version 5.20.2
121
+
122
+ - [fix] AWS S3 API ListObjectsV2 may return corrupted XML, retry it
123
+
124
+ ## version 5.20.1
125
+
126
+ - [new] new job class my-import-delta.
127
+
128
+ ## version 5.20.0
129
+
130
+ - [new] streaming_load: Reduces the number of transaction.
131
+
132
+ ## version 5.19.1
133
+
134
+ - [new] streaming_load: new option --ctl-prefix and --keep-ctl (both is optional).
135
+
136
+ ## version 5.19.0
137
+
138
+ - [new] bricolage, bricolage-jobnet, Bricolage::CommandLineApplication now do not block on executing queries in PostgreSQL-like DBs (including Redshift).
139
+ - [CHANGE] Removes (maybe) unused method PostgresConnection#streaming_execute_query. Use #query_batch instead.
140
+
141
+ ## version 5.18.1
142
+
143
+ - new class SNSDataSource.
144
+ - new class NullLogger.
145
+ - new exception S3Exception.
146
+ - new exception SNSException.
147
+
148
+ ## version 5.18.0
149
+
150
+ - [new] New parameter "no-backup" for my-import and my-migrate job classes.
151
+ - [new] New parameter "sql_log_level" for the psql data source.
152
+ - [new] Shows SQL source location before the query.
153
+ - Raises ConnectionError for all connection-level problems, while it raises SQLError for SQL-level errors.
154
+
155
+ ## version 5.17.2
156
+
157
+ - [fix] Using CommandLineApplication with --environment option causes unexpected option error
158
+
159
+ ## version 5.17.1
160
+
161
+ - [fix] --dry-run option did not work for my-import job class.
162
+ - [new] AWS access key id & secret key are now optional for S3 data sources (to allow using EC2 instance or ECS task attached IAM role)
163
+
164
+ ## version 5.17.0
165
+
166
+ - [new] Supports Redshift attached IAM role for COPY and UNLOAD.
167
+
168
+ ## version 5.16.9
169
+
170
+ - code-level change only: [new] new method Transaction#truncate_and_commit
171
+
172
+ ## version 5.16.8
173
+
174
+ - code-level change only
175
+
176
+ ## version 5.16.7
177
+
178
+ - [fix] require 'bricolage/context' wrongly caused NameError.
179
+ - [new] PostgresConnection#drop_table_force utilizes DROP TABLE IF EXISTS.
180
+
181
+ ## version 5.16.6
182
+
183
+ - rebuild-rename, rebuild-drop, my-import, my-migrate, create, createview: Reduces the number of transactions for speed.
184
+
185
+ ## version 5.16.5
186
+
187
+ - [fix] my-import: mys3dump: Fixes buffer size problem.
188
+ - [fix] my-import: mys3dump: Escapes more meta characters (e.g. \n, \r, \v, ...).
189
+
190
+ ## version 5.16.4
191
+
192
+ - [fix] Adds dependency to rake
193
+ - [fix] my-import: Reduces warning log messages.
194
+
195
+ ## version 5.16.3
196
+
197
+ - [fix] streaming_load: Disables statupdate for log staging table, it is useless.
198
+
199
+ ## version 5.16.2
200
+
201
+ - [fix] streaming_load: Disables compupdate on COPY. This *might* cause Assert error on some clusters.
202
+
203
+ ## version 5.16.1
204
+
205
+ - [fix] Fixes syntax error on ruby 2.1
206
+
207
+ ## version 5.16.0
208
+
209
+ - [CHANGE][EXPERIMENTAL] streaming_load: Always reuse same temporary log table xxxx_l_wk instead of temporary xxxx_l_tmpNNNN. This *might* cause Redshift DDL slow down, I try to reduce the number of drop-create.
210
+
211
+ ## version 5.15.2
212
+
213
+ - [fix] redis-export: remove un-required error check.
214
+
215
+ ## version 5.15.1
216
+
217
+ - [new] redis-export: make faster using cursor and Redis pipeline.
218
+
219
+ ## version 5.15.0
220
+
221
+ - [new][EXPERIMENTAL] new job class redis-export.
222
+
223
+ ## version 5.14.0
224
+
225
+ - [new] streaming_load: Fast log check by temporary load log table.
226
+ - [new] streaming_load: Ignores all S3 key-does-not-exist errors; they are caused by S3 eventual consistency.
227
+
228
+ ## version 5.13.1
229
+
230
+ - [fix] load, streaming_load: "encrypted" load option should not be used for SSE-KMS
231
+
232
+ ## version 5.13.0
233
+
234
+ - [new] streaming_load: Supports S3 server-side encryption with AWS KMS (Key Management Service).
235
+ - Now Bricolage requires Ruby AWS-SDK v2 for AWS signature v4.
236
+
237
+ ## version 5.12.5
238
+
239
+ - [fix] Ruby 2.1 does not have Etc.uname, use uname command instead.
240
+
241
+ ## version 5.12.4
242
+
243
+ - [new] Supports loading from encrypted S3 data source.
244
+ - [new] New job class "createview".
245
+ - [new] Now "create" and "sql" job class support "grant" parameter.
246
+
247
+ ## version 5.12.3
248
+
249
+ - [new] my-migrate job class supports sql-file parameter for export.
250
+
251
+ ## version 5.12.2
252
+
253
+ - [new] td-export job class supports .sql.job file
254
+
255
+ ## version 5.12.1
256
+
257
+ - [fix] ensure unlocking VACUUM lock, also when VACUUM statement was failed.
258
+
259
+ ## version 5.12.0
260
+
261
+ - [new] Introduces subsystem-wise variable file (SUBSYS/variable.yml)
262
+ - [new] Allows providing default options by "defaults" global variable (e.g. enabling "grant" option by default)
263
+
264
+ ## version 5.11.0
265
+
266
+ - [fix] Supports jobnet which has both a job and a jobnet
267
+
268
+ ## version 5.10.0
269
+
270
+ - streaming_load: new option --sql-file
271
+
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ task :test do
2
+ load "#{__dir__}/test/all.rb"
3
+ end
data/bricolage.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/bricolage/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.platform = Gem::Platform::RUBY
5
+ s.name = 'bricolage'
6
+ s.version = Bricolage::VERSION
7
+ s.summary = 'SQL Batch Framework'
8
+ s.description = 'Redshift-oriented Data Warehouse Batch Framework'
9
+ s.license = 'MIT'
10
+
11
+ s.author = ['Minero Aoki']
12
+ s.email = 'aamine@loveruby.net'
13
+ s.homepage = 'https://github.com/bricolages/bricolage'
14
+
15
+ s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
16
+ s.executables = s.files.grep(%r{bin/}).map {|path| File.basename(path) }
17
+ s.require_path = 'lib'
18
+
19
+ s.required_ruby_version = '>= 2.0.0'
20
+ s.add_dependency 'pg', '~> 0.18.0'
21
+ s.add_dependency 'aws-sdk-s3', '~> 1'
22
+ s.add_dependency 'aws-sdk-sns', '~> 1'
23
+ s.add_development_dependency 'test-unit'
24
+ s.add_development_dependency 'rake'
25
+ s.add_development_dependency 'mocha'
26
+ end
data/jobclass/exec.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  JobClass.define('exec') {
2
2
  parameters {|params|
3
- params.add StringListParam.new('args', 'ARG', 'Command line arguments.')
3
+ params.add StringListParam.new('args', 'ARG', 'Command line arguments.', allow_string: true)
4
+ params.add KeyValuePairsParam.new('env', 'ENVS', 'Environment variables.')
4
5
  }
5
6
 
6
7
  script {|params, script|
7
8
  script.task(params.generic_ds) {|task|
8
9
  task.action(params['args'].join(' ')) {|ds|
9
10
  ds.logger.info '[CMD] ' + params['args'].join(' ')
10
- system(*params['args'])
11
+ environ = params['env'] || {}
12
+ argv = params['args']
13
+ system(environ, *argv)
11
14
  st = $?
12
15
  ds.logger.info "status=#{st.exitstatus}"
13
16
  JobResult.for_bool(st.exitstatus == 0)
@@ -16,11 +16,19 @@ module Bricolage
16
16
  end
17
17
 
18
18
  def load_yaml(path)
19
- parse_yaml(load_text(path), path)
19
+ parse_yaml(load_eruby(path), path)
20
20
  end
21
21
 
22
- def load_text(path)
23
- eruby(read_file(path), path)
22
+ def load_eruby(path)
23
+ eruby(load_file(path), path)
24
+ end
25
+
26
+ alias load_text load_eruby # FIXME: obsolete
27
+
28
+ def load_file(path)
29
+ File.read(path)
30
+ rescue SystemCallError => err
31
+ raise ParameterError, "could not read file: #{err.message}"
24
32
  end
25
33
 
26
34
  def eruby(text, path)
@@ -39,12 +47,6 @@ module Bricolage
39
47
  raise ParameterError, "#{path}: config file syntax error: #{err.message}"
40
48
  end
41
49
 
42
- def read_file(path)
43
- File.read(path)
44
- rescue SystemCallError => err
45
- raise ParameterError, "could not read file: #{err.message}"
46
- end
47
-
48
50
  #
49
51
  # For embedded code
50
52
  #
@@ -71,7 +73,7 @@ module Bricolage
71
73
  # $base_dir + "vars.yml" -> "$base_dir/vars.yml"
72
74
  # $base_dir + "/abs/path/vars.yml" -> "/abs/path/vars.yml"
73
75
  def read_config_file(path)
74
- load_text(relative_path(Pathname(path)))
76
+ load_eruby(relative_path(Pathname(path)))
75
77
  end
76
78
  end
77
79
 
@@ -5,15 +5,20 @@ require 'bricolage/exception'
5
5
  module Bricolage
6
6
 
7
7
  class DataSourceFactory
8
+ DATA_SOURCE_FILE_NAME_1 = 'datasource.yml'
9
+ DATA_SOURCE_FILE_NAME_2 = 'database.yml'
10
+ PASSWORD_FILE_NAME = 'password.yml'
11
+
8
12
  def DataSourceFactory.load(context, logger)
9
13
  loader = Loader.new(context, logger)
10
- loader.load_passwords
11
- loader.load
14
+ loader.load_passwords(PASSWORD_FILE_NAME)
15
+ begin
16
+ return loader.load(DATA_SOURCE_FILE_NAME_1)
17
+ rescue ParameterError
18
+ return loader.load(DATA_SOURCE_FILE_NAME_2)
19
+ end
12
20
  end
13
21
 
14
- DEFAULT_CONFIG_FILE_NAME = 'database.yml'
15
- DEFAULT_PASSWORD_FILE_NAME = 'password.yml'
16
-
17
22
  class Loader < ConfigLoader
18
23
  def initialize(context, logger)
19
24
  super context.home_path
@@ -22,7 +27,7 @@ module Bricolage
22
27
  @passwords = nil
23
28
  end
24
29
 
25
- def load_passwords(basename = DEFAULT_PASSWORD_FILE_NAME)
30
+ def load_passwords(basename)
26
31
  @context.config_pathes(basename).each do |path|
27
32
  if path.exist?
28
33
  @passwords = load_yaml(path)
@@ -31,11 +36,11 @@ module Bricolage
31
36
  end
32
37
  end
33
38
 
34
- def load(basename = DEFAULT_CONFIG_FILE_NAME)
35
- database_yml = @context.config_pathes(basename).detect {|path| path.exist? }
36
- raise ParameterError, "database.yml does not exist" unless database_yml
37
- @config_dir = database_yml.parent
38
- DataSourceFactory.new(load_yaml(database_yml), @context, @logger)
39
+ def load(basename)
40
+ yml_path = @context.config_pathes(basename).detect(&:exist?)
41
+ raise ParameterError, "database.yml does not exist" unless yml_path
42
+ @config_dir = yml_path.parent
43
+ DataSourceFactory.new(load_yaml(yml_path), @context, @logger)
39
44
  end
40
45
 
41
46
  def password(name)
data/lib/bricolage/job.rb CHANGED
@@ -23,6 +23,9 @@ module Bricolage
23
23
  f = JobFile.load(ctx, path)
24
24
  instantiate(f.job_id, f.class_id, ctx).tap {|job|
25
25
  job.bind_parameters f.values
26
+ f.global_variables.each do |name, value|
27
+ job.global_variables[name.to_s] = value
28
+ end
26
29
  }
27
30
  end
28
31
 
@@ -1,23 +1,29 @@
1
1
  require 'bricolage/exception'
2
2
  require 'pathname'
3
+ require 'stringio'
3
4
 
4
5
  module Bricolage
5
6
 
6
7
  class JobFile
7
8
  def JobFile.load(ctx, path)
8
- values = if /\.sql\.job\z/ =~ path.to_s
9
- load_embedded_definition(ctx, path)
10
- else
11
- ctx.parameter_file_loader.load_yaml(path)
12
- end
9
+ values =
10
+ case path.to_s
11
+ when /\.sql\.job\z/
12
+ load_embedded_definition(ctx, path)
13
+ when /\.(?:rb|py|sh)\.job\z/
14
+ load_program_embedded_definition(ctx, path)
15
+ else
16
+ ctx.parameter_file_loader.load_yaml(path)
17
+ end
13
18
  parse(values, path)
14
19
  end
15
20
 
16
21
  class << JobFile
17
22
  private
18
23
 
24
+ # For .sql.job
19
25
  def load_embedded_definition(ctx, path)
20
- sql = ctx.parameter_file_loader.load_text(path)
26
+ sql = ctx.parameter_file_loader.load_eruby(path)
21
27
  block = sql.slice(%r{\A/\*.*?^\*/}m) or
22
28
  raise ParameterError, "missing embedded job definition block: #{path}"
23
29
  yaml = block.sub(%r{\A/\*}, '').sub(%r{^\*/\s*\z}, '')
@@ -70,6 +76,30 @@ module Bricolage
70
76
  end
71
77
  decls
72
78
  end
79
+
80
+ # For .rb.job, .py.job, .sh.job ("#" comment style files)
81
+ # This method does NOT expand variables of parameter files.
82
+ def load_program_embedded_definition(ctx, path)
83
+ script = StringIO.new(ctx.parameter_file_loader.load_file(path))
84
+ first_line = script.gets
85
+ if first_line.start_with?('#!')
86
+ yaml_lines = []
87
+ else
88
+ yaml_lines = [first_line]
89
+ end
90
+ script.each_line do |line|
91
+ break unless line.start_with?('#')
92
+ yaml_lines.push line[1..-1]
93
+ end
94
+ yaml = yaml_lines.join
95
+
96
+ begin
97
+ values = YAML.load(yaml)
98
+ rescue => err
99
+ raise ParameterError, "#{path}: embedded job definition syntax error: #{err.message}"
100
+ end
101
+ values
102
+ end
73
103
  end
74
104
 
75
105
  def JobFile.parse(values, path)
@@ -97,6 +127,12 @@ module Bricolage
97
127
  def subsystem
98
128
  @path.parent.basename.to_s
99
129
  end
130
+
131
+ def global_variables
132
+ {
133
+ 'script' => @path.to_s
134
+ }
135
+ end
100
136
  end
101
137
 
102
138
  end
@@ -604,8 +604,9 @@ module Bricolage
604
604
  end
605
605
 
606
606
  class StringListParam < Param
607
- def initialize(name, arg_spec, description, optional: false, publish: false)
607
+ def initialize(name, arg_spec, description, optional: false, publish: false, allow_string: false)
608
608
  super name, arg_spec, description, optional: optional, publish: publish
609
+ @allow_string = allow_string
609
610
  end
610
611
 
611
612
  def parse_option_value(value, list)
@@ -614,7 +615,10 @@ module Bricolage
614
615
  end
615
616
 
616
617
  def parse_value(vals)
617
- raise ParameterError, "bad type for parameter #{name}: #{vals.class}" unless vals.kind_of?(Array)
618
+ unless vals.kind_of?(Array)
619
+ raise ParameterError, "bad type for parameter #{name}: #{vals.class}" unless @allow_string
620
+ vals = [vals]
621
+ end
618
622
  vals.empty? ? nil : vals
619
623
  end
620
624
 
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.27.2'
3
+ VERSION = '5.28.0'
4
4
  end
@@ -0,0 +1,9 @@
1
+ create table $dest_table
2
+ ( job_process_id varchar(256) encode lzo
3
+ , start_time timestamp encode delta
4
+ , end_time timestamp encode delta
5
+ , target_table varchar(256) encode lzo
6
+ , data_file varchar(2048) encode lzo
7
+ )
8
+ sortkey (job_process_id)
9
+ ;