#NEWLINE# @ mock . patch ( 'sahara.conductor.API.job_execution_update' ) #NEWLINE# @ mock . patch ( 'sahara.conductor.API.job_execution_get' ) #NEWLINE# @ mock . patch ( 'sahara.utils.remote.get_remote' ) #NEWLINE# @ mock . patch ( 'sahara.plugins.utils.get_config_value_or_default' ) #NEWLINE# @ mock . patch ( 'sahara.service.edp.job_utils.create_workflow_dir' ) #NEWLINE# @ mock . patch ( 'sahara.plugins.utils.get_instance' ) #NEWLINE# @ mock . patch ( 'sahara.conductor.API.job_get' ) #NEWLINE# @ mock . patch ( 'sahara.context.ctx' , return_value = 'ctx' ) #NEWLINE# def _setup_run_job( self , master_instance , job_configs , files , ctx , job_get , get_instance , create_workflow_dir , get_config_value , get_remote , job_exec_get , job_exec_update ) : #NEWLINE# #INDENT# def _upload_job_files( where , job_dir , job , libs_subdir = True , job_configs = None ) : #NEWLINE# #INDENT# paths = [ os . path . join ( self . workflow_dir , f ) for f in files [ 'jars' ] ] #NEWLINE# bltns = files . get ( 'bltns' , [ ] ) #NEWLINE# bltns = [ os . path . join ( self . workflow_dir , f ) for f in bltns ] #NEWLINE# return ( paths , bltns ) #NEWLINE# #UNINDENT# job = mock . Mock ( ) #NEWLINE# job . name = 'MyJob' #NEWLINE# job_get . return_value = job #NEWLINE# job_exec = mock . Mock ( ) #NEWLINE# job_exec . job_configs = job_configs #NEWLINE# get_config_value . side_effect = self . _config_values #NEWLINE# create_workflow_dir . return_value = self . workflow_dir #NEWLINE# get_remote . return_value . __enter__ = mock . Mock ( return_value = master_instance ) #NEWLINE# get_instance . return_value = master_instance #NEWLINE# eng = self . engine_class ( 'cluster' ) #NEWLINE# eng . _upload_job_files = mock . Mock ( ) #NEWLINE# eng . _upload_job_files . side_effect = _upload_job_files #NEWLINE# status = eng . run_job ( job_exec ) #NEWLINE# get_instance . assert_called_with ( 'cluster' , self . master_host ) #NEWLINE# return status