#NEWLINE# @ validation . required_services ( consts . Service . SAHARA ) #NEWLINE# @ validation . required_contexts ( 'users' , 'sahara_image' , 'sahara_job_binaries' , 'sahara_cluster' ) #NEWLINE# @ scenario . configure ( context = { #NEWLINE# #INDENT# 'cleanup' : [ 'sahara' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# def create_launch_job( self , job_type , configs , job_idx = 0 ) : #NEWLINE# #INDENT# 'Create and execute a Sahara EDP Job.\n\n        This scenario Creates a Job entity and launches an execution on a\n        Cluster.\n\n        :param job_type: type of the Data Processing Job\n        :param configs: config dict that will be passed to a Job Execution\n        :param job_idx: index of a job in a sequence. This index will be\n                        used to create different atomic actions for each job\n                        in a sequence\n        ' #NEWLINE# mains = self . context [ 'tenant' ] [ 'sahara' ] [ 'mains' ] #NEWLINE# libs = self . context [ 'tenant' ] [ 'sahara' ] [ 'libs' ] #NEWLINE# name = self . generate_random_name ( ) #NEWLINE# job = self . clients ( 'sahara' ) . jobs . create ( name = name , type = job_type , description = '' , mains = mains , libs = libs ) #NEWLINE# cluster_id = self . context [ 'tenant' ] [ 'sahara' ] [ 'cluster' ] #NEWLINE# if ( job_type . lower ( ) == 'java' ) : #NEWLINE# #INDENT# input_id = None #NEWLINE# output_id = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# input_id = self . context [ 'tenant' ] [ 'sahara' ] [ 'input' ] #NEWLINE# output_id = self . _create_output_ds ( ) . id #NEWLINE# #UNINDENT# self . _run_job_execution ( job_id = job . id , cluster_id = cluster_id , input_id = input_id , output_id = output_id , configs = configs , job_idx = job_idx )