<s> from oslo_config import cfg <EOL> from oslo_log import log as logging <EOL> from sahara import conductor <EOL> from sahara import context <EOL> from sahara . plugins import utils <EOL> from sahara . plugins . vanilla import abstractversionhandler as avm <EOL> from sahara . plugins . vanilla . hadoop2 import config as c <EOL> from sahara . plugins . vanilla . hadoop2 import keypairs <EOL> from sahara . plugins . vanilla . hadoop2 import recommendations_utils as ru <EOL> from sahara . plugins . vanilla . hadoop2 import run_scripts as run <EOL> from sahara . plugins . vanilla . hadoop2 import scaling as sc <EOL> from sahara . plugins . vanilla . hadoop2 import starting_scripts as s_scripts <EOL> from sahara . plugins . vanilla . hadoop2 import validation as vl <EOL> from sahara . plugins . vanilla import utils as vu <EOL> from sahara . plugins . vanilla . v2_7_1 import config_helper as c_helper <EOL> from sahara . plugins . vanilla . v2_7_1 import edp_engine <EOL> from sahara . swift import swift_helper <EOL> from sahara . utils import cluster as cluster_utils <EOL> conductor = conductor . API <EOL> LOG = logging . getLogger ( __name__ ) <EOL> CONF = cfg . CONF <EOL> class VersionHandler ( avm . AbstractVersionHandler ) : <EOL> def __init__ ( self ) : <EOL> self . pctx = { <EOL> '<STR_LIT>' : c_helper . get_env_configs ( ) , <EOL> '<STR_LIT>' : c_helper . get_plugin_configs ( ) <EOL> } <EOL> def get_plugin_configs ( self ) : <EOL> return self . pctx [ '<STR_LIT>' ] <EOL> def get_node_processes ( self ) : <EOL> return { <EOL> "<STR_LIT>" : [ ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" ] <EOL> } <EOL> def validate ( self , cluster ) : <EOL> vl . validate_cluster_creating ( self . pctx , cluster ) <EOL> def update_infra ( self , cluster ) : <EOL> pass <EOL> def configure_cluster ( self , cluster ) : <EOL> c . configure_cluster ( self . pctx , cluster ) <EOL> def start_cluster ( self , cluster ) : <EOL> keypairs . provision_keypairs ( cluster ) <EOL> s_scripts . start_namenode ( cluster ) <EOL> s_scripts . start_secondarynamenode ( cluster ) <EOL> s_scripts . start_resourcemanager ( cluster ) <EOL> run . start_dn_nm_processes ( utils . get_instances ( cluster ) ) <EOL> run . await_datanodes ( cluster ) <EOL> s_scripts . start_historyserver ( cluster ) <EOL> s_scripts . start_oozie ( self . pctx , cluster ) <EOL> s_scripts . start_hiveserver ( self . pctx , cluster ) <EOL> swift_helper . install_ssl_certs ( cluster_utils . get_instances ( cluster ) ) <EOL> self . _set_cluster_info ( cluster ) <EOL> def decommission_nodes ( self , cluster , instances ) : <EOL> sc . decommission_nodes ( self . pctx , cluster , instances ) <EOL> def validate_scaling ( self , cluster , existing , additional ) : <EOL> vl . validate_additional_ng_scaling ( cluster , additional ) <EOL> vl . validate_existing_ng_scaling ( self . pctx , cluster , existing ) <EOL> def scale_cluster ( self , cluster , instances ) : <EOL> keypairs . provision_keypairs ( cluster , instances ) <EOL> sc . scale_cluster ( self . pctx , cluster , instances ) <EOL> def _set_cluster_info ( self , cluster ) : <EOL> nn = vu . get_namenode ( cluster ) <EOL> rm = vu . get_resourcemanager ( cluster ) <EOL> hs = vu . get_historyserver ( cluster ) <EOL> oo = vu . get_oozie ( cluster ) <EOL> info = { } <EOL> if rm : <EOL> info [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' % ( rm . management_ip , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' % ( rm . management_ip , '<STR_LIT>' ) <EOL> } <EOL> if nn : <EOL> info [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' % ( nn . management_ip , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' % ( nn . hostname ( ) , '<STR_LIT>' ) <EOL> } <EOL> if oo : <EOL> info [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' % ( oo . management_ip , '<STR_LIT>' ) <EOL> } <EOL> if hs : <EOL> info [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' % ( hs . management_ip , '<STR_LIT>' ) <EOL> } <EOL> ctx = context . ctx ( ) <EOL> conductor . cluster_update ( ctx , cluster , { '<STR_LIT:info>' : info } ) <EOL> def get_edp_engine ( self , cluster , job_type ) : <EOL> if job_type in edp_engine . EdpOozieEngine . get_supported_job_types ( ) : <EOL> return edp_engine . EdpOozieEngine ( cluster ) <EOL> return None <EOL> def get_edp_job_types ( self ) : <EOL> return edp_engine . EdpOozieEngine . get_supported_job_types ( ) <EOL> def get_edp_config_hints ( self , job_type ) : <EOL> return edp_engine . EdpOozieEngine . get_possible_job_config ( job_type ) <EOL> def on_terminate_cluster ( self , cluster ) : <EOL> keypairs . drop_key ( cluster ) <EOL> def get_open_ports ( self , node_group ) : <EOL> return c . get_open_ports ( node_group ) <EOL> def recommend_configs ( self , cluster , scaling ) : <EOL> ru . recommend_configs ( cluster , self . get_plugin_configs ( ) , scaling ) </s>
