<s> from sahara import context <EOL> from sahara . i18n import _ <EOL> from sahara . plugins import exceptions as pex <EOL> from sahara . plugins . fake import edp_engine <EOL> from sahara . plugins import provisioning as p <EOL> from sahara . plugins import utils as plugin_utils <EOL> class FakePluginProvider ( p . ProvisioningPluginBase ) : <EOL> def get_title ( self ) : <EOL> return "<STR_LIT>" <EOL> def get_description ( self ) : <EOL> return _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def get_versions ( self ) : <EOL> return [ "<STR_LIT>" ] <EOL> def get_node_processes ( self , hadoop_version ) : <EOL> return { <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> } <EOL> def get_configs ( self , hadoop_version ) : <EOL> return [ ] <EOL> def configure_cluster ( self , cluster ) : <EOL> with context . ThreadGroup ( ) as tg : <EOL> for instance in plugin_utils . get_instances ( cluster ) : <EOL> tg . spawn ( '<STR_LIT>' % instance . id , <EOL> self . _write_ops , instance ) <EOL> def start_cluster ( self , cluster ) : <EOL> with context . ThreadGroup ( ) as tg : <EOL> for instance in plugin_utils . get_instances ( cluster ) : <EOL> tg . spawn ( '<STR_LIT>' % instance . id , <EOL> self . _check_ops , instance ) <EOL> def scale_cluster ( self , cluster , instances ) : <EOL> with context . ThreadGroup ( ) as tg : <EOL> for instance in instances : <EOL> tg . spawn ( '<STR_LIT>' % instance . id , <EOL> self . _all_check_ops , instance ) <EOL> def decommission_nodes ( self , cluster , instances ) : <EOL> pass <EOL> def _write_ops ( self , instance ) : <EOL> with instance . remote ( ) as r : <EOL> r . execute_command ( '<STR_LIT>' ) <EOL> data_1 = "<STR_LIT>" <EOL> r . write_file_to ( '<STR_LIT>' , data_1 , run_as_root = True ) <EOL> data_2 = "<STR_LIT>" <EOL> r . append_to_file ( '<STR_LIT>' , data_2 , run_as_root = True ) <EOL> r . replace_remote_string ( '<STR_LIT>' , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def _check_ops ( self , instance ) : <EOL> expected_data = "<STR_LIT>" <EOL> with instance . remote ( ) as r : <EOL> actual_data = r . read_file_from ( '<STR_LIT>' , run_as_root = True ) <EOL> if actual_data . strip ( ) != expected_data . strip ( ) : <EOL> raise pex . HadoopProvisionError ( "<STR_LIT>" % ( <EOL> actual_data , expected_data ) ) <EOL> def _all_check_ops ( self , instance ) : <EOL> self . _write_ops ( instance ) <EOL> self . _check_ops ( instance ) <EOL> def get_edp_engine ( self , cluster , job_type ) : <EOL> return edp_engine . FakeJobEngine ( ) <EOL> def get_edp_job_types ( self , versions = None ) : <EOL> res = { } <EOL> for vers in self . get_versions ( ) : <EOL> if not versions or vers in versions : <EOL> res [ vers ] = edp_engine . FakeJobEngine . get_supported_job_types ( ) <EOL> return res <EOL> def get_edp_config_hints ( self , job_type , version ) : <EOL> if version in self . get_versions ( ) : <EOL> return edp_engine . FakeJobEngine . get_possible_job_config ( job_type ) </s>
