@@ -52,19 +52,19 @@ def destroy_component(self, application_name, create_data):
52
52
application_name ,
53
53
json .dumps (create_data ))
54
54
# terminate oozie jobs
55
- self ._kill_oozie (create_data ['job_handle' ], self . OOZIE_USER_NAME )
55
+ self ._kill_oozie (create_data ['job_handle' ], create_data [ 'application_user' ] )
56
56
57
57
# delete component from hdfs
58
58
remote_path = create_data ['component_hdfs_root' ][1 :]
59
59
self ._hdfs_client .remove (remote_path , recursive = True )
60
60
61
61
def start_component (self , application_name , create_data ):
62
62
logging .debug ("start_component: %s %s" , application_name , json .dumps (create_data ))
63
- self ._start_oozie (create_data ['job_handle' ], self . OOZIE_USER_NAME )
63
+ self ._start_oozie (create_data ['job_handle' ], create_data [ 'application_user' ] )
64
64
65
65
def stop_component (self , application_name , create_data ):
66
66
logging .debug ("stop_component: %s %s" , application_name , json .dumps (create_data ))
67
- self ._stop_oozie (create_data ['job_handle' ], self . OOZIE_USER_NAME )
67
+ self ._stop_oozie (create_data ['job_handle' ], create_data [ 'application_user' ] )
68
68
69
69
def create_component (self , staged_component_path , application_name , component , properties ):
70
70
logging .debug (
@@ -89,7 +89,7 @@ def create_component(self, staged_component_path, application_name, component, p
89
89
properties ['deployment_end' ] = end .strftime ("%Y-%m-%dT%H:%MZ" )
90
90
91
91
# insert required oozie properties
92
- properties ['user.name' ] = self . OOZIE_USER_NAME
92
+ properties ['user.name' ] = properties [ 'application_user' ]
93
93
# Oozie ShareLib - supports actions
94
94
properties ['oozie.use.system.libpath' ] = 'true'
95
95
# platform shared libs e.g. hbase
@@ -104,12 +104,14 @@ def create_component(self, staged_component_path, application_name, component, p
104
104
properties [def_path ] = '%s/%s' % (self ._environment ['name_node' ], remote_path )
105
105
106
106
# deploy everything to various hadoop services
107
- undeploy = self ._deploy_to_hadoop (properties , staged_component_path , remote_path )
107
+ undeploy = self ._deploy_to_hadoop (properties , staged_component_path , remote_path , properties [ 'application_user' ] )
108
108
109
109
# return something that can be used to undeploy later
110
- return {'job_handle' : undeploy ['id' ], 'component_hdfs_root' : properties ['component_hdfs_root' ]}
110
+ return {'job_handle' : undeploy ['id' ],
111
+ 'component_hdfs_root' : properties ['component_hdfs_root' ],
112
+ 'application_user' : properties ['application_user' ]}
111
113
112
- def _deploy_to_hadoop (self , properties , staged_component_path , remote_path , exclude = None ):
114
+ def _deploy_to_hadoop (self , properties , staged_component_path , remote_path , application_user , exclude = None ):
113
115
if exclude is None :
114
116
exclude = []
115
117
exclude .extend (['hdfs.json' ,
@@ -127,7 +129,7 @@ def _deploy_to_hadoop(self, properties, staged_component_path, remote_path, excl
127
129
128
130
# submit to oozie
129
131
result = self ._submit_oozie (properties )
130
- self ._stop_oozie (result ['id' ], self . OOZIE_USER_NAME )
132
+ self ._stop_oozie (result ['id' ], application_user )
131
133
132
134
return result
133
135
0 commit comments