#NEWLINE# @ skip_without_drmaa #NEWLINE# @ skip_unless_module ( 'kombu' ) #NEWLINE# @ integration_test #NEWLINE# def test_restart_finishes_job( self ) : #NEWLINE# #INDENT# with self . _setup_app_provider ( 'restart_and_finish' ) as app_provider : #NEWLINE# #INDENT# job_id = '12345' #NEWLINE# with app_provider . new_app ( ) as app : #NEWLINE# #INDENT# manager = app . only_manager #NEWLINE# job_info = { #NEWLINE# #INDENT# 'job_id' : job_id , #NEWLINE# 'command_line' : 'sleep 1000' , #NEWLINE# 'setup' : True , #NEWLINE# #UNINDENT# } #NEWLINE# submit_job ( manager , job_info ) #NEWLINE# external_id = None #NEWLINE# for i in range ( 10 ) : #NEWLINE# #INDENT# time . sleep ( 0.05 ) #NEWLINE# external_id = manager . _proxied_manager . _external_id ( job_id ) #NEWLINE# if external_id : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if ( external_id is None ) : #NEWLINE# #INDENT# assert False , "Test failed, couldn't get exteranl id for job id." #NEWLINE# #UNINDENT# #UNINDENT# drmaa_session = DrmaaSessionFactory ( ) . get ( ) #NEWLINE# drmaa_session . kill ( external_id ) #NEWLINE# drmaa_session . close ( ) #NEWLINE# consumer = self . _status_update_consumer ( 'restart_and_finish' ) #NEWLINE# consumer . start ( ) #NEWLINE# with app_provider . new_app ( ) as app : #NEWLINE# #INDENT# consumer . wait_for_messages ( ) #NEWLINE# #UNINDENT# consumer . join ( ) #NEWLINE# assert ( len ( i . messages ) == 1 ) , len ( consumer . messages ) #NEWLINE# assert ( consumer . messages [ 0 ] [ 'status' ] == 'complete' )