@@ -29,13 +29,9 @@ def build_applications(parsed_applications, parsed_globals, ami_version=None):
2929 build_supported_product (
3030 app_config ['Name' ], app_config .get ('Args' )))
3131 elif app_name == constants .HIVE :
32- hive_version = app_config .get ('Version' )
33- if hive_version is None :
34- hive_version = constants .LATEST
32+ hive_version = constants .LATEST
3533 step_list .append (
36- _build_install_hive_step (
37- region = parsed_globals .region ,
38- version = hive_version ))
34+ _build_install_hive_step (region = parsed_globals .region ))
3935 args = app_config .get ('Args' )
4036 if args is not None :
4137 hive_site_path = _find_matching_arg (
@@ -44,41 +40,36 @@ def build_applications(parsed_applications, parsed_globals, ami_version=None):
4440 step_list .append (
4541 _build_install_hive_site_step (
4642 region = parsed_globals .region ,
47- version = hive_version ,
4843 hive_site_path = hive_site_path ))
4944 elif app_name == constants .PIG :
50- pig_version = app_config .get ('Version' )
51- if pig_version is None :
52- pig_version = constants .LATEST
45+ pig_version = constants .LATEST
5346 step_list .append (
54- emrutils .build_pig_install_step (
55- region = parsed_globals .region ,
56- version = pig_version ))
47+ _build_pig_install_step (
48+ region = parsed_globals .region ))
5749 elif app_name == constants .GANGLIA :
5850 ba_list .append (
59- build_ganglia_install_bootstrap_action (
51+ _build_ganglia_install_bootstrap_action (
6052 region = parsed_globals .region ))
6153 elif app_name == constants .HBASE :
6254 ba_list .append (
63- build_hbase_install_bootstrap_action (
55+ _build_hbase_install_bootstrap_action (
6456 region = parsed_globals .region ))
6557 if ami_version >= '3.0' :
6658 step_list .append (
67- build_hbase_install_step (
59+ _build_hbase_install_step (
6860 constants .HBASE_PATH_HADOOP2_INSTALL_JAR ))
6961 elif ami_version >= '2.1' :
7062 step_list .append (
71- build_hbase_install_step (
63+ _build_hbase_install_step (
7264 constants .HBASE_PATH_HADOOP1_INSTALL_JAR ))
7365 else :
7466 raise ValueError ('aws: error: AMI version ' + ami_version +
7567 'is not compatible with HBase.' )
7668 elif app_name == constants .IMPALA :
7769 ba_list .append (
78- build_impala_install_bootstrap_action (
70+ _build_impala_install_bootstrap_action (
7971 region = parsed_globals .region ,
80- args = app_config .get ('Args' ),
81- version = app_config .get ('Version' )))
72+ args = app_config .get ('Args' )))
8273 else :
8374 raise exceptions .UnknownApplicationError (app_name = app_name )
8475
@@ -92,38 +83,36 @@ def build_supported_product(name, args):
9283 return config
9384
9485
95- def build_ganglia_install_bootstrap_action (region ):
86+ def _build_ganglia_install_bootstrap_action (region ):
9687 return emrutils .build_bootstrap_action (
9788 name = constants .INSTALL_GANGLIA_NAME ,
9889 path = emrutils .build_s3_link (
9990 relative_path = constants .GANGLIA_INSTALL_BA_PATH ,
10091 region = region ))
10192
10293
103- def build_hbase_install_bootstrap_action (region ):
94+ def _build_hbase_install_bootstrap_action (region ):
10495 return emrutils .build_bootstrap_action (
10596 name = constants .INSTALL_HBASE_NAME ,
10697 path = emrutils .build_s3_link (
10798 relative_path = constants .HBASE_INSTALL_BA_PATH ,
10899 region = region ))
109100
110101
111- def build_hbase_install_step (jar ):
102+ def _build_hbase_install_step (jar ):
112103 return emrutils .build_step (
113104 jar = jar ,
114105 name = constants .START_HBASE_NAME ,
115106 action_on_failure = constants .TERMINATE_CLUSTER ,
116107 args = constants .HBASE_INSTALL_ARG )
117108
118109
119- def build_impala_install_bootstrap_action (region , version , args = None ):
120- if version is None :
121- version = 'latest'
110+ def _build_impala_install_bootstrap_action (region , args = None ):
122111 args_list = [
123112 constants .BASE_PATH_ARG ,
124113 emrutils .build_s3_link (region = region ),
125114 constants .IMPALA_VERSION ,
126- version ]
115+ constants . LATEST ]
127116 if args is not None :
128117 args_list .append (constants .IMPALA_CONF )
129118 args_list += args
@@ -135,15 +124,15 @@ def build_impala_install_bootstrap_action(region, version, args=None):
135124 args = args_list )
136125
137126
138- def _build_install_hive_step (region , version ,
127+ def _build_install_hive_step (region ,
139128 action_on_failure = constants .TERMINATE_CLUSTER ):
140129 step_args = [
141130 emrutils .build_s3_link (constants .HIVE_SCRIPT_PATH , region ),
142131 constants .INSTALL_HIVE_ARG ,
143132 constants .BASE_PATH_ARG ,
144133 emrutils .build_s3_link (constants .HIVE_BASE_PATH ),
145134 constants .HIVE_VERSIONS ,
146- version ]
135+ constants . LATEST ]
147136 step = emrutils .build_step (
148137 name = constants .INSTALL_HIVE_NAME ,
149138 action_on_failure = action_on_failure ,
@@ -152,7 +141,7 @@ def _build_install_hive_step(region, version,
152141 return step
153142
154143
155- def _build_install_hive_site_step (region , version , hive_site_path ,
144+ def _build_install_hive_site_step (region , hive_site_path ,
156145 action_on_failure = constants .CANCEL_AND_WAIT ):
157146 step_args = [
158147 emrutils .build_s3_link (constants .HIVE_SCRIPT_PATH , region ),
@@ -161,7 +150,7 @@ def _build_install_hive_site_step(region, version, hive_site_path,
161150 constants .INSTALL_HIVE_SITE_ARG ,
162151 hive_site_path ,
163152 constants .HIVE_VERSIONS ,
164- version ]
153+ constants . LATEST ]
165154 step = emrutils .build_step (
166155 name = constants .INSTALL_HIVE_SITE_NAME ,
167156 action_on_failure = action_on_failure ,
@@ -170,6 +159,23 @@ def _build_install_hive_site_step(region, version, hive_site_path,
170159 return step
171160
172161
162+ def _build_pig_install_step (region ,
163+ action_on_failure = constants .TERMINATE_CLUSTER ):
164+ step_args = [
165+ emrutils .build_s3_link (constants .PIG_SCRIPT_PATH , region ),
166+ constants .INSTALL_PIG_ARG ,
167+ constants .BASE_PATH_ARG ,
168+ emrutils .build_s3_link (constants .PIG_BASE_PATH , region ),
169+ constants .PIG_VERSIONS ,
170+ constants .LATEST ]
171+ step = emrutils .build_step (
172+ name = constants .INSTALL_PIG_NAME ,
173+ action_on_failure = action_on_failure ,
174+ jar = emrutils .build_s3_link (constants .SCRIPT_RUNNER_PATH , region ),
175+ args = step_args )
176+ return step
177+
178+
173179def _find_matching_arg (key , args_list ):
174180 for arg in args_list :
175181 if key in arg :
0 commit comments