3434
3535import deployer_utils
3636from plugins .base_creator import Creator
37- from exceptiondef import FailedCreation
37+ from exceptiondef import FailedCreation , FailedValidation
3838
3939class OozieCreator (Creator ):
4040
@@ -48,6 +48,17 @@ def validate_component(self, component):
4848 def get_component_type (self ):
4949 return 'oozie'
5050
51+ def assert_application_properties (self , override_properties , default_properties ):
52+ # Assert application properties before creating the application
53+ for component in default_properties :
54+ properties = default_properties [component ].copy ()
55+ properties .update (override_properties .get (component , {}))
56+ if 'spark_version' in properties and properties ['spark_version' ] != self ._config ['oozie_spark_version' ]:
57+ information = "Mismatch between cluster's oozie spark version (version = %s) and \
58+ requested spark version" % self ._config ['oozie_spark_version' ]
59+ raise FailedValidation (json .dumps ({"information" : information }))
60+ properties = None
61+
5162 def destroy_component (self , application_name , create_data ):
5263 logging .debug (
5364 "destroy_component: %s %s" ,
@@ -98,7 +109,7 @@ def create_component(self, staged_component_path, application_name, user_name, c
98109 # platform shared libs e.g. hbase
99110 properties ['oozie.libpath' ] = '/pnda/deployment/platform'
100111 # For spark2 add a special setting to select spark2
101- if 'component_spark_version' in properties and properties [ 'component_spark_version ' ] == '2' :
112+ if self . _config [ 'oozie_spark_version ' ] == '2' :
102113 properties ['oozie.action.sharelib.for.spark' ] = 'spark2'
103114
104115 # insert default queue selection
0 commit comments