#NEWLINE# @ mock . patch ( 'sahara.conductor.API.job_execution_update' ) #NEWLINE# @ mock . patch ( 'sahara.conductor.API.job_execution_get' ) #NEWLINE# @ mock . patch ( 'sahara.service.edp.job_manager._run_job' ) #NEWLINE# @ mock . patch ( 'sahara.service.edp.job_manager.cancel_job' ) #NEWLINE# def test_run_job_handles_exceptions_with_run_job( self , canceljob , runjob , job_ex_get , job_ex_upd ) : #NEWLINE# #INDENT# runjob . side_effect = ex . OozieException ( 'run_job failed' ) #NEWLINE# ( job , job_exec ) = u . create_job_exec ( edp . JOB_TYPE_PIG ) #NEWLINE# job_exec . engine_job_id = 'fake_oozie_id' #NEWLINE# job_ex_get . return_value = job_exec #NEWLINE# job_manager . run_job ( job_exec . id ) #NEWLINE# self . assertEqual ( 1 , job_ex_get . call_count ) #NEWLINE# self . assertEqual ( 1 , job_ex_upd . call_count ) #NEWLINE# new_status = job_ex_upd . call_args [ 0 ] [ 2 ] [ 'info' ] [ 'status' ] #NEWLINE# self . assertEqual ( edp . JOB_STATUS_FAILED , new_status ) #NEWLINE# self . assertEqual ( 1 , canceljob . call_count )