aw_datapipe 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/aw_datapipe.gemspec +1 -1
- data/lib/aw_datapipe/pipeline.rb +48 -4
- data/lib/aw_datapipe/pipeline_object.rb +16 -2
- data/lib/aw_datapipe/version.rb +1 -1
- data/lib/aw_datapipe.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfef690d9ba54e7838eb2d46b45face330762037
|
4
|
+
data.tar.gz: 5cbba46fc31a079b9b4743b9a0439fb35259efbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f41ad60618c2def93ff91fd43b05d6163a135ba037b7e4afa782f16f0e886433a71311df35696eed1f4221057a4e70308b0e15061b51012a0674e621e28b710
|
7
|
+
data.tar.gz: 040f2327a07d062e3a6c47bef7770e8d8b6e9db2be690a5840631e9d8548172c3dbd3914abf34595acd9df7a90cf70303717d6e07ff30032dfef5b0eeee2c14d
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
- Updating.
|
5
5
|
- http://stackoverflow.com/questions/31188739/how-to-automate-the-updating-editing-of-amazon-data-pipeline
|
6
6
|
- http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-manage-pipeline-modify-console.html
|
7
|
-
- Add DSL using clean room.
|
8
7
|
- Add Thor based utility instead of console for downloads.
|
9
8
|
- Generate separate SQL script files.
|
10
9
|
- Codecov.
|
@@ -12,6 +11,12 @@
|
|
12
11
|
- Rubydocs.
|
13
12
|
- AWS labs examples converted to DSL.
|
14
13
|
|
14
|
+
## 0.3.0 - 2018-06-14
|
15
|
+
- Use AWS SDK v3.
|
16
|
+
- Separate appending activities from initializing pipeline with config.
|
17
|
+
- Add helper methods to provide a more hierarchical builder API.
|
18
|
+
- Provide default settings for a pipeline EC2 resource.
|
19
|
+
|
15
20
|
## 0.2.4 - 2017-05-24
|
16
21
|
- Add ShellCommandActivity optional parameters.
|
17
22
|
|
data/aw_datapipe.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.required_ruby_version = '>= 2.2.2'
|
25
25
|
|
26
26
|
spec.add_dependency("activesupport", ">= 3")
|
27
|
-
spec.add_dependency("aws-sdk",
|
27
|
+
spec.add_dependency("aws-sdk-datapipeline", '~> 1')
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.14"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/aw_datapipe/pipeline.rb
CHANGED
@@ -9,20 +9,64 @@ module AwDatapipe
|
|
9
9
|
|
10
10
|
# objects [Array]
|
11
11
|
def initialize(objects, parameter_metadata, parameter_values)
|
12
|
-
objects
|
13
|
-
|
12
|
+
@objects = ObjectHash.new
|
13
|
+
append_objects_with_dependencies(objects)
|
14
14
|
@parameter_metadata, @parameter_values = parameter_metadata, parameter_values
|
15
|
+
yield(self) if block_given?
|
15
16
|
end
|
16
17
|
|
17
18
|
def self.build(config, activities, parameter_metadata, parameter_values)
|
18
|
-
|
19
|
-
|
19
|
+
new([config], parameter_metadata, parameter_values) do |pipeline|
|
20
|
+
pipeline.append_objects_with_dependencies(activities)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [PipelineObject] appended object
|
25
|
+
def append_object(object)
|
26
|
+
object.pipeline = self
|
27
|
+
objects[object.id] = object
|
28
|
+
end
|
29
|
+
|
30
|
+
def append_object_with_dependencies(object)
|
31
|
+
[*object.dependencies, object].each(&method(:append_object))
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [Pipeline] self
|
35
|
+
def append_objects_with_dependencies(objects)
|
36
|
+
objects.each(&method(:append_object_with_dependencies))
|
37
|
+
self
|
20
38
|
end
|
21
39
|
|
22
40
|
def configuration
|
23
41
|
objects.fetch(:default)
|
24
42
|
end
|
25
43
|
|
44
|
+
def csv_data_format(params)
|
45
|
+
append_object CsvDataFormat.build(params)
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param [Hash] params Various required and optional parameters.
|
49
|
+
# @option params [String] :name (default: 'Ec2Instance')
|
50
|
+
# @option params [String] :instance_type (default: 't1.micro')
|
51
|
+
# @option params [String] :subnet_id
|
52
|
+
# @option params [String] :security_group_ids
|
53
|
+
# @option params [String] :action_on_task_failure (default: 'terminate')
|
54
|
+
# @option params [String] :terminate_after (default: '2 Hours')
|
55
|
+
#
|
56
|
+
# @return [Ec2Resource]
|
57
|
+
def ec2_resource(params)
|
58
|
+
append_object Ec2Resource.build(
|
59
|
+
params.reverse_merge(name: 'Ec2Instance', instance_type: 't1.micro', action_on_task_failure: 'terminate', terminate_after: '2 Hours'))
|
60
|
+
end
|
61
|
+
|
62
|
+
def jdbc_database(params)
|
63
|
+
append_object JdbcDatabase.build(params)
|
64
|
+
end
|
65
|
+
|
66
|
+
def s3_data_node(params)
|
67
|
+
append_object S3DataNode.build(params)
|
68
|
+
end
|
69
|
+
|
26
70
|
def referenced_object_ids
|
27
71
|
referenced_objects.map(&:id) << :default
|
28
72
|
end
|
@@ -59,7 +59,16 @@ module AwDatapipe
|
|
59
59
|
Configuration = PipelineObject.new(:failure_and_rerun_mode, :pipeline_log_uri, :resource_role, :role, :schedule, :schedule_type)
|
60
60
|
Schedule = PipelineObject.new(:period, :start_date_time)
|
61
61
|
|
62
|
-
Ec2Resource = PipelineObject.new(:action_on_task_failure, :instance_type, :security_group_ids, :subnet_id, :terminate_after)
|
62
|
+
Ec2Resource = PipelineObject.new(:action_on_task_failure, :instance_type, :security_group_ids, :subnet_id, :terminate_after) do
|
63
|
+
def copy_activity(params)
|
64
|
+
pipeline.append_object CopyActivity.build(params.merge(runs_on: self))
|
65
|
+
end
|
66
|
+
|
67
|
+
def shell_command_activity(params)
|
68
|
+
pipeline.append_object ShellCommandActivity.build(params.merge(runs_on: self))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
63
72
|
S3DataNode = PipelineObject.new(:directory_path, :data_format, :file_path)
|
64
73
|
CsvDataFormat = PipelineObject.new(:column) do
|
65
74
|
def type
|
@@ -68,7 +77,12 @@ module AwDatapipe
|
|
68
77
|
end
|
69
78
|
ShellCommandActivity = PipelineObject.new(:input, :output, :runs_on, :command, :script_argument, :script_uri, :stage)
|
70
79
|
|
71
|
-
JdbcDatabase = PipelineObject.new(:_password, :connection_string, :jdbc_driver_class, :username)
|
80
|
+
JdbcDatabase = PipelineObject.new(:_password, :connection_string, :jdbc_driver_class, :username) do
|
81
|
+
def sql_data_node(params)
|
82
|
+
pipeline.append_object SqlDataNode.build(params.merge(database: self))
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
72
86
|
SqlDataNode = PipelineObject.new(:database, :select_query, :table)
|
73
87
|
CopyActivity = PipelineObject.new(:input, :output, :runs_on)
|
74
88
|
|
data/lib/aw_datapipe/version.rb
CHANGED
data/lib/aw_datapipe.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aw_datapipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piers Chambers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: aws-sdk
|
28
|
+
name: aws-sdk-datapipeline
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.4.8
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Unofficial ruby wrapper for the AWS SDK Data Pipeline API.
|