masamune 0.15.6 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/Rakefile +1 -1
- data/bin/{masamune-elastic-mapreduce → masamune-aws-emr} +3 -3
- data/bin/masamune-dump +1 -1
- data/bin/masamune-hive +1 -1
- data/bin/masamune-psql +1 -1
- data/bin/masamune-shell +1 -1
- data/lib/masamune.rb +1 -1
- data/lib/masamune/actions.rb +1 -1
- data/lib/masamune/actions/{elastic_mapreduce.rb → aws_emr.rb} +14 -30
- data/lib/masamune/actions/data_flow.rb +1 -1
- data/lib/masamune/actions/date_parse.rb +1 -1
- data/lib/masamune/actions/execute.rb +1 -1
- data/lib/masamune/actions/filesystem.rb +1 -1
- data/lib/masamune/actions/hadoop_filesystem.rb +1 -1
- data/lib/masamune/actions/hadoop_streaming.rb +10 -8
- data/lib/masamune/actions/hive.rb +2 -2
- data/lib/masamune/actions/invoke_parallel.rb +1 -1
- data/lib/masamune/actions/postgres.rb +1 -1
- data/lib/masamune/actions/postgres_admin.rb +1 -1
- data/lib/masamune/actions/s3cmd.rb +1 -1
- data/lib/masamune/actions/transform.rb +1 -1
- data/lib/masamune/after_initialize_callbacks.rb +1 -1
- data/lib/masamune/cached_filesystem.rb +2 -2
- data/lib/masamune/commands.rb +1 -1
- data/lib/masamune/commands/{elastic_mapreduce.rb → aws_emr.rb} +38 -29
- data/lib/masamune/commands/hadoop_filesystem.rb +1 -1
- data/lib/masamune/commands/hadoop_streaming.rb +1 -1
- data/lib/masamune/commands/hive.rb +1 -1
- data/lib/masamune/commands/postgres.rb +1 -1
- data/lib/masamune/commands/postgres_admin.rb +1 -1
- data/lib/masamune/commands/postgres_common.rb +1 -1
- data/lib/masamune/commands/retry_with_backoff.rb +1 -1
- data/lib/masamune/commands/s3cmd.rb +1 -1
- data/lib/masamune/commands/shell.rb +11 -7
- data/lib/masamune/configuration.rb +2 -38
- data/lib/masamune/data_plan.rb +1 -1
- data/lib/masamune/data_plan/builder.rb +1 -1
- data/lib/masamune/data_plan/elem.rb +1 -1
- data/lib/masamune/data_plan/engine.rb +1 -1
- data/lib/masamune/data_plan/rule.rb +1 -1
- data/lib/masamune/data_plan/set.rb +1 -1
- data/lib/masamune/environment.rb +1 -1
- data/lib/masamune/filesystem.rb +1 -1
- data/lib/masamune/has_environment.rb +1 -1
- data/lib/masamune/helpers.rb +1 -1
- data/lib/masamune/helpers/postgres.rb +1 -1
- data/lib/masamune/io.rb +1 -1
- data/lib/masamune/last_element.rb +1 -1
- data/lib/masamune/method_logger.rb +1 -1
- data/lib/masamune/multi_io.rb +1 -1
- data/lib/masamune/schema.rb +1 -1
- data/lib/masamune/schema/catalog.rb +1 -1
- data/lib/masamune/schema/column.rb +1 -1
- data/lib/masamune/schema/dimension.rb +1 -1
- data/lib/masamune/schema/fact.rb +1 -1
- data/lib/masamune/schema/map.rb +1 -1
- data/lib/masamune/schema/row.rb +1 -1
- data/lib/masamune/schema/store.rb +1 -1
- data/lib/masamune/schema/table.rb +1 -1
- data/lib/masamune/schema/table_reference.rb +1 -1
- data/lib/masamune/spec_helper.rb +1 -1
- data/lib/masamune/string_format.rb +1 -1
- data/lib/masamune/tasks/aws_emr_thor.rb +79 -0
- data/lib/masamune/tasks/dump_thor.rb +1 -1
- data/lib/masamune/tasks/hive_thor.rb +2 -2
- data/lib/masamune/tasks/postgres_thor.rb +1 -1
- data/lib/masamune/tasks/shell_thor.rb +1 -1
- data/lib/masamune/template.rb +1 -1
- data/lib/masamune/thor.rb +1 -1
- data/lib/masamune/topological_hash.rb +1 -1
- data/lib/masamune/transform.rb +1 -1
- data/lib/masamune/transform/bulk_upsert.rb +1 -1
- data/lib/masamune/transform/common.rb +1 -1
- data/lib/masamune/transform/common/denormalize_table.rb +1 -1
- data/lib/masamune/transform/consolidate_dimension.rb +1 -1
- data/lib/masamune/transform/deduplicate_dimension.rb +1 -1
- data/lib/masamune/transform/define_schema.rb +1 -1
- data/lib/masamune/transform/define_table.rb +1 -1
- data/lib/masamune/transform/denormalize_table.rb +1 -1
- data/lib/masamune/transform/hive.rb +1 -1
- data/lib/masamune/transform/hive/define_schema.hql.erb +1 -1
- data/lib/masamune/transform/hive/define_table.hql.erb +1 -1
- data/lib/masamune/transform/hive/define_table.rb +1 -1
- data/lib/masamune/transform/hive/denormalize_table.hql.erb +1 -1
- data/lib/masamune/transform/hive/denormalize_table.rb +1 -1
- data/lib/masamune/transform/insert_reference_values.rb +1 -1
- data/lib/masamune/transform/load_dimension.rb +1 -1
- data/lib/masamune/transform/load_fact.rb +1 -1
- data/lib/masamune/transform/operator.rb +1 -1
- data/lib/masamune/transform/postgres.rb +1 -1
- data/lib/masamune/transform/postgres/bulk_upsert.psql.erb +1 -1
- data/lib/masamune/transform/postgres/bulk_upsert.rb +1 -1
- data/lib/masamune/transform/postgres/deduplicate_dimension.psql.erb +1 -1
- data/lib/masamune/transform/postgres/deduplicate_dimension.rb +1 -1
- data/lib/masamune/transform/postgres/define_foreign_key.psql.erb +1 -1
- data/lib/masamune/transform/postgres/define_index.psql.erb +1 -1
- data/lib/masamune/transform/postgres/define_inheritance.psql.erb +1 -1
- data/lib/masamune/transform/postgres/define_schema.psql.erb +1 -1
- data/lib/masamune/transform/postgres/define_table.psql.erb +1 -1
- data/lib/masamune/transform/postgres/define_table.rb +1 -1
- data/lib/masamune/transform/postgres/define_unique.psql.erb +1 -1
- data/lib/masamune/transform/postgres/denormalize_table.psql.erb +1 -1
- data/lib/masamune/transform/postgres/denormalize_table.rb +1 -1
- data/lib/masamune/transform/postgres/insert_reference_values.psql.erb +1 -1
- data/lib/masamune/transform/postgres/insert_reference_values.rb +1 -1
- data/lib/masamune/transform/postgres/relabel_dimension.psql.erb +1 -1
- data/lib/masamune/transform/postgres/relabel_dimension.rb +1 -1
- data/lib/masamune/transform/postgres/replace_table.psql.erb +1 -1
- data/lib/masamune/transform/postgres/rollup_fact.psql.erb +1 -1
- data/lib/masamune/transform/postgres/rollup_fact.rb +1 -1
- data/lib/masamune/transform/postgres/snapshot_dimension.psql.erb +1 -1
- data/lib/masamune/transform/postgres/snapshot_dimension.rb +1 -1
- data/lib/masamune/transform/postgres/stage_dimension.psql.erb +1 -1
- data/lib/masamune/transform/postgres/stage_dimension.rb +1 -1
- data/lib/masamune/transform/postgres/stage_fact.psql.erb +1 -1
- data/lib/masamune/transform/postgres/stage_fact.rb +1 -1
- data/lib/masamune/transform/relabel_dimension.rb +1 -1
- data/lib/masamune/transform/rollup_fact.rb +1 -1
- data/lib/masamune/transform/snapshot_dimension.rb +1 -1
- data/lib/masamune/transform/stage_dimension.rb +1 -1
- data/lib/masamune/transform/stage_fact.rb +1 -1
- data/lib/masamune/version.rb +2 -2
- data/spec/fixtures/aggregate.sql.erb +1 -1
- data/spec/fixtures/comment.sql.erb +1 -1
- data/spec/fixtures/invalid.sql.erb +1 -1
- data/spec/fixtures/relative.sql.erb +1 -1
- data/spec/fixtures/simple.sql.erb +1 -1
- data/spec/fixtures/whitespace.sql.erb +1 -1
- data/spec/masamune/actions/{elastic_mapreduce_spec.rb → aws_emr_spec.rb} +22 -42
- data/spec/masamune/actions/execute_spec.rb +1 -1
- data/spec/masamune/actions/hadoop_filesystem_spec.rb +1 -1
- data/spec/masamune/actions/hadoop_streaming_spec.rb +8 -8
- data/spec/masamune/actions/hive_spec.rb +5 -5
- data/spec/masamune/actions/invoke_parallel_spec.rb +1 -1
- data/spec/masamune/actions/postgres_admin_spec.rb +1 -1
- data/spec/masamune/actions/postgres_spec.rb +1 -1
- data/spec/masamune/actions/s3cmd_spec.rb +1 -1
- data/spec/masamune/actions/transform_spec.rb +1 -1
- data/spec/masamune/after_initialization_callbacks_spec.rb +1 -1
- data/spec/masamune/cached_filesystem_spec.rb +1 -1
- data/spec/masamune/commands/aws_emr_spec.rb +115 -0
- data/spec/masamune/commands/hadoop_filesystem_spec.rb +1 -1
- data/spec/masamune/commands/hadoop_streaming_spec.rb +1 -1
- data/spec/masamune/commands/hive_spec.rb +1 -1
- data/spec/masamune/commands/postgres_admin_spec.rb +1 -1
- data/spec/masamune/commands/postgres_spec.rb +1 -1
- data/spec/masamune/commands/retry_with_backoff_spec.rb +1 -1
- data/spec/masamune/commands/s3cmd_spec.rb +1 -1
- data/spec/masamune/commands/shell_spec.rb +79 -2
- data/spec/masamune/configuration_spec.rb +1 -65
- data/spec/masamune/data_plan/builder_spec.rb +1 -1
- data/spec/masamune/data_plan/elem_spec.rb +1 -1
- data/spec/masamune/data_plan/engine_spec.rb +1 -1
- data/spec/masamune/data_plan/rule_spec.rb +1 -1
- data/spec/masamune/data_plan/set_spec.rb +1 -1
- data/spec/masamune/environment_spec.rb +1 -1
- data/spec/masamune/filesystem_spec.rb +1 -1
- data/spec/masamune/helpers/postgres_spec.rb +1 -1
- data/spec/masamune/rspec/job_fixture_spec.rb +1 -1
- data/spec/masamune/rspec/mock_filesystem_spec.rb +1 -1
- data/spec/masamune/rspec/shared_example_group_spec.rb +1 -1
- data/spec/masamune/schema/catalog_spec.rb +1 -1
- data/spec/masamune/schema/column_spec.rb +1 -1
- data/spec/masamune/schema/dimension_spec.rb +1 -1
- data/spec/masamune/schema/fact_spec.rb +1 -1
- data/spec/masamune/schema/map_spec.rb +1 -1
- data/spec/masamune/schema/row_spec.rb +1 -1
- data/spec/masamune/schema/store_spec.rb +1 -1
- data/spec/masamune/schema/table_spec.rb +1 -1
- data/spec/masamune/string_format_spec.rb +1 -1
- data/spec/masamune/tasks/aws_emr_thor_spec.rb +69 -0
- data/spec/masamune/tasks/dump_thor_spec.rb +1 -1
- data/spec/masamune/tasks/hive_thor_spec.rb +1 -1
- data/spec/masamune/tasks/postgres_thor_spec.rb +1 -1
- data/spec/masamune/tasks/shell_thor_spec.rb +1 -1
- data/spec/masamune/template_spec.rb +1 -1
- data/spec/masamune/thor_spec.rb +1 -1
- data/spec/masamune/transform/bulk_upsert.dimension_spec.rb +1 -1
- data/spec/masamune/transform/consolidate_dimension_spec.rb +1 -1
- data/spec/masamune/transform/deduplicate_dimension_spec.rb +1 -1
- data/spec/masamune/transform/define_schema_spec.rb +1 -1
- data/spec/masamune/transform/define_table.dimension_spec.rb +1 -1
- data/spec/masamune/transform/define_table.fact_spec.rb +1 -1
- data/spec/masamune/transform/define_table.table_spec.rb +1 -1
- data/spec/masamune/transform/denormalize_table_spec.rb +1 -1
- data/spec/masamune/transform/insert_reference_values.dimension_spec.rb +1 -1
- data/spec/masamune/transform/insert_reference_values.fact_spec.rb +1 -1
- data/spec/masamune/transform/load_dimension_spec.rb +1 -1
- data/spec/masamune/transform/load_fact_spec.rb +1 -1
- data/spec/masamune/transform/relabel_dimension_spec.rb +1 -1
- data/spec/masamune/transform/rollup_fact_spec.rb +1 -1
- data/spec/masamune/transform/snapshot_dimension_spec.rb +1 -1
- data/spec/masamune/transform/stage_dimension_spec.rb +1 -1
- data/spec/masamune/transform/stage_fact_spec.rb +1 -1
- data/spec/masamune_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/masamune/example_group.rb +1 -1
- data/spec/support/masamune/job_example_group.rb +1 -1
- data/spec/support/masamune/job_fixture.rb +1 -1
- data/spec/support/masamune/mock_command.rb +1 -1
- data/spec/support/masamune/mock_delegate.rb +1 -1
- data/spec/support/masamune/mock_filesystem.rb +1 -1
- data/spec/support/masamune/shared_example_group.rb +1 -1
- data/spec/support/masamune/step_example_group.rb +1 -1
- data/spec/support/masamune/step_fixture.rb +1 -1
- data/spec/support/masamune/task_example_group.rb +1 -1
- data/spec/support/masamune/thor_mute.rb +1 -1
- data/spec/support/rspec/example/action_example_group.rb +1 -1
- data/spec/support/rspec/example/task_example_group.rb +1 -1
- data/spec/support/rspec/example/transform_example_group.rb +1 -1
- data/spec/support/shared_examples/postgres_common_examples.rb +1 -1
- metadata +14 -13
- data/lib/masamune/commands/interactive.rb +0 -37
- data/lib/masamune/tasks/elastic_mapreduce_thor.rb +0 -61
- data/spec/masamune/tasks/elastic_mapreduce_thor_spec.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8bcd874b8f53a052225b41043cfda18de823cec
|
4
|
+
data.tar.gz: 9e4c71e47097a5035be079b92ce9d2698d74c7b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e4b65c5424fdf38915854a32299cc7825418f96798c63719619a8cc4bfd7a69d81e286006974b5660a03cb3b020a677b7db838cf5efa0f03d79ff4cac209053
|
7
|
+
data.tar.gz: 8099dca87827675a761f9882025452d0c8bfd24773b09538006747e5b155d1ef9ec2f82a16bb16d5dc7b313aec748081d07541c332be5e633299c0dfeb88000c
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014-
|
3
|
+
Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -22,5 +22,5 @@
|
|
22
22
|
# THE SOFTWARE.
|
23
23
|
|
24
24
|
$: << File.expand_path('../../lib/', __FILE__)
|
25
|
-
require 'masamune/tasks/
|
26
|
-
Masamune::Tasks::
|
25
|
+
require 'masamune/tasks/aws_emr_thor'
|
26
|
+
Masamune::Tasks::AwsEmrThor.start(ARGV)
|
data/bin/masamune-dump
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
data/bin/masamune-hive
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
data/bin/masamune-psql
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
data/bin/masamune-shell
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/masamune.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/masamune/actions.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -21,49 +21,33 @@
|
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
23
|
module Masamune::Actions
|
24
|
-
module
|
24
|
+
module AwsEmr
|
25
25
|
extend ActiveSupport::Concern
|
26
26
|
|
27
|
-
def
|
27
|
+
def aws_emr(opts = {})
|
28
28
|
opts = opts.to_hash.symbolize_keys
|
29
|
-
opts[:jobflow] = resolve_jobflow(opts[:jobflow]) if opts[:jobflow]
|
30
29
|
|
31
|
-
command = Masamune::Commands::
|
32
|
-
command = Masamune::Commands::
|
33
|
-
command = Masamune::Commands::RetryWithBackoff.new(command, configuration.elastic_mapreduce.slice(:retries, :backoff).merge(opts))
|
30
|
+
command = Masamune::Commands::AwsEmr.new(environment, opts)
|
31
|
+
command = Masamune::Commands::RetryWithBackoff.new(command, configuration.aws_emr.slice(:retries, :backoff).merge(opts))
|
34
32
|
command = Masamune::Commands::Shell.new(command, opts)
|
35
33
|
|
36
34
|
command.interactive? ? command.replace : command.execute
|
37
35
|
end
|
38
36
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
def resolve_jobflow(jobflow)
|
44
|
-
return unless jobflow
|
45
|
-
defined_jobflows[jobflow.to_sym] || jobflow
|
46
|
-
end
|
47
|
-
|
48
|
-
def jobflow_required?
|
49
|
-
extra.empty?
|
50
|
-
end
|
51
|
-
|
52
|
-
def validate_jobflow!
|
53
|
-
return unless jobflow_required?
|
54
|
-
jobflow = configuration.elastic_mapreduce[:jobflow]
|
55
|
-
raise ::Thor::RequiredArgumentMissingError, "No value provided for required options '--jobflow'" unless jobflow
|
56
|
-
raise ::Thor::RequiredArgumentMissingError, %Q(Value '#{jobflow}' for '--jobflow' doesn't exist) unless elastic_mapreduce(extra: '--list', jobflow: jobflow, fail_fast: false).success?
|
37
|
+
def validate_cluster_id!
|
38
|
+
cluster_id = configuration.aws_emr[:cluster_id]
|
39
|
+
raise ::Thor::RequiredArgumentMissingError, "No value provided for required options '--cluster-id'" unless cluster_id
|
40
|
+
raise ::Thor::RequiredArgumentMissingError, %Q(AWS EMR cluster '#{cluster_id}' does not exist) unless aws_emr(action: 'describe-cluster', cluster_id: cluster_id, fail_fast: false).success?
|
57
41
|
end
|
58
42
|
|
59
43
|
included do |base|
|
60
|
-
base.class_option :
|
44
|
+
base.class_option :cluster_id, :desc => "AWS EMR cluster_id ID (Hint: `masamune-emr-aws list-clusters`)" if defined?(base.class_option)
|
61
45
|
base.after_initialize(:early) do |thor, options|
|
62
|
-
next unless thor.configuration.
|
63
|
-
next unless thor.configuration.
|
64
|
-
thor.configuration.
|
46
|
+
next unless thor.configuration.aws_emr.any?
|
47
|
+
next unless thor.configuration.aws_emr.fetch(:enabled, true)
|
48
|
+
thor.configuration.aws_emr[:cluster_id] = options[:cluster_id] if options[:cluster_id]
|
65
49
|
next unless options[:initialize]
|
66
|
-
thor.
|
50
|
+
thor.validate_cluster_id!
|
67
51
|
end if defined?(base.after_initialize)
|
68
52
|
end
|
69
53
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -25,17 +25,19 @@ module Masamune::Actions
|
|
25
25
|
def hadoop_streaming(opts = {})
|
26
26
|
opts = opts.to_hash.symbolize_keys
|
27
27
|
|
28
|
-
command =
|
29
|
-
|
30
|
-
else
|
31
|
-
Masamune::Commands::HadoopStreaming.new(environment, opts)
|
32
|
-
end
|
33
|
-
|
34
|
-
command = Masamune::Commands::ElasticMapReduce.new(command, opts.except(:extra)) if configuration.elastic_mapreduce[:jobflow]
|
28
|
+
command = Masamune::Commands::HadoopStreaming.new(environment, aws_emr_options(opts))
|
29
|
+
command = Masamune::Commands::AwsEmr.new(command, opts.except(:extra)) if configuration.aws_emr[:cluster_id]
|
35
30
|
command = Masamune::Commands::RetryWithBackoff.new(command, configuration.hadoop_streaming.slice(:retries, :backoff).merge(opts))
|
36
31
|
command = Masamune::Commands::Shell.new(command, opts)
|
37
32
|
|
38
33
|
command.execute
|
39
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def aws_emr_options(opts = {})
|
39
|
+
return opts unless configuration.aws_emr[:cluster_id]
|
40
|
+
opts.merge(quote: true, upload: false)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -33,7 +33,7 @@ module Masamune::Actions
|
|
33
33
|
opts.merge!(block: block.to_proc) if block_given?
|
34
34
|
|
35
35
|
command = Masamune::Commands::Hive.new(environment, opts)
|
36
|
-
command = Masamune::Commands::
|
36
|
+
command = Masamune::Commands::AwsEmr.new(command, opts.except(:extra)) if configuration.aws_emr[:cluster_id]
|
37
37
|
command = Masamune::Commands::RetryWithBackoff.new(command, configuration.hive.slice(:retries, :backoff).merge(opts))
|
38
38
|
command = Masamune::Commands::Shell.new(command, opts)
|
39
39
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -36,7 +36,7 @@ module Masamune
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def exists?(file)
|
39
|
-
glob(file, max_depth: 0).include?(file)
|
39
|
+
glob(file, max_depth: 0).include?(file)
|
40
40
|
end
|
41
41
|
|
42
42
|
def glob(file_or_glob, options = {})
|
data/lib/masamune/commands.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c) 2014-
|
3
|
+
# Copyright (c) 2014-2016, VMware, Inc. All Rights Reserved.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -25,22 +25,23 @@ require 'delegate'
|
|
25
25
|
require 'masamune/actions/execute'
|
26
26
|
|
27
27
|
module Masamune::Commands
|
28
|
-
class
|
28
|
+
class AwsEmr < SimpleDelegator
|
29
29
|
include Masamune::Actions::Execute
|
30
30
|
|
31
31
|
DEFAULT_ATTRIBUTES =
|
32
32
|
{
|
33
|
-
:path
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
33
|
+
:path => 'aws',
|
34
|
+
:extra => [],
|
35
|
+
:config_file => nil,
|
36
|
+
:action => nil,
|
37
|
+
:cluster_id => nil,
|
38
|
+
:interactive => false
|
38
39
|
}
|
39
40
|
|
40
41
|
def initialize(delegate, attrs = {})
|
41
42
|
super delegate
|
42
43
|
@delegate = delegate
|
43
|
-
DEFAULT_ATTRIBUTES.merge(configuration.
|
44
|
+
DEFAULT_ATTRIBUTES.merge(configuration.aws_emr).merge(attrs).each do |name, value|
|
44
45
|
instance_variable_set("@#{name}", value)
|
45
46
|
end
|
46
47
|
end
|
@@ -48,55 +49,55 @@ module Masamune::Commands
|
|
48
49
|
def interactive?
|
49
50
|
if @delegate.respond_to?(:interactive?)
|
50
51
|
@delegate.interactive?
|
51
|
-
elsif @extra.any?
|
52
|
-
true
|
53
52
|
else
|
54
|
-
@
|
53
|
+
@interactive
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
58
|
-
def
|
59
|
-
if @delegate.respond_to?(:stdin)
|
60
|
-
@delegate.stdin
|
61
|
-
elsif @input
|
62
|
-
@stdin ||= StringIO.new(@input)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def elastic_mapreduce_command
|
57
|
+
def aws_emr_command
|
67
58
|
args = []
|
68
59
|
args << @path
|
69
|
-
args <<
|
70
|
-
args <<
|
71
|
-
args
|
60
|
+
args << 'emr'
|
61
|
+
args << action
|
62
|
+
args << 'cluster-running' if @action == 'wait'
|
63
|
+
args << action_options.map(&:to_a)
|
64
|
+
args << ['--cluster-id', @cluster_id] if @cluster_id
|
65
|
+
args
|
72
66
|
end
|
73
67
|
|
74
68
|
def ssh_args
|
75
69
|
args = []
|
76
|
-
args <<
|
77
|
-
args << '--
|
70
|
+
args << aws_emr_command
|
71
|
+
args << '--command'
|
78
72
|
args << 'exit'
|
79
73
|
args.flatten
|
80
74
|
end
|
81
75
|
|
82
|
-
# Use
|
76
|
+
# Use `aws emr` to translate cluster_id into raw ssh command
|
83
77
|
def ssh_command
|
84
78
|
@ssh_command ||= begin
|
85
79
|
result = nil
|
86
80
|
execute(*ssh_args, fail_fast: true, safe: true) do |line|
|
81
|
+
next if result
|
87
82
|
if line =~ /exit\Z/
|
88
83
|
result = line.sub(/ exit\Z/, '').split(' ')
|
89
84
|
else
|
90
|
-
logger.
|
85
|
+
logger.debug(line)
|
91
86
|
end
|
92
87
|
end
|
93
88
|
result
|
94
89
|
end
|
95
90
|
end
|
96
91
|
|
92
|
+
def command_env
|
93
|
+
{}.tap do |env|
|
94
|
+
env['AWS_CONFIG_FILE'] = @config_file if @config_file
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
97
98
|
def command_args
|
98
99
|
args = []
|
99
|
-
args << (ssh_command? ? ssh_command :
|
100
|
+
args << (ssh_command? ? ssh_command : aws_emr_command)
|
100
101
|
args << @extra
|
101
102
|
args << @delegate.command_args if @delegate.respond_to?(:command_args)
|
102
103
|
args.flatten
|
@@ -112,8 +113,16 @@ module Masamune::Commands
|
|
112
113
|
|
113
114
|
private
|
114
115
|
|
116
|
+
def action
|
117
|
+
@action || 'ssh'
|
118
|
+
end
|
119
|
+
|
120
|
+
def action_options
|
121
|
+
configuration.aws_emr.fetch(action.underscore.to_sym, {}).with_indifferent_access.fetch(:options, {}).reject { |key, _| @extra.include?(key.to_s) }
|
122
|
+
end
|
123
|
+
|
115
124
|
def ssh_command?
|
116
|
-
@delegate.respond_to?(:command_args)
|
125
|
+
@delegate.respond_to?(:command_args)
|
117
126
|
end
|
118
127
|
end
|
119
128
|
end
|