#NEWLINE# def write_into_shared_storage( traj ) : #NEWLINE# #INDENT# traj . f_add_result ( 'ggg' , 42 ) #NEWLINE# traj . f_add_derived_parameter ( 'huuu' , 46 ) #NEWLINE# root = get_root_logger ( ) #NEWLINE# daarrays = traj . res . daarrays #NEWLINE# idx = traj . v_idx #NEWLINE# ncores = traj [ traj . v_environment_name ] . f_get_default ( 'ncores' , 1 ) #NEWLINE# root . info ( '1. This' ) #NEWLINE# a = daarrays . a #NEWLINE# a [ idx ] = idx #NEWLINE# root . info ( '2. is' ) #NEWLINE# ca = daarrays . ca #NEWLINE# ca [ idx ] = idx #NEWLINE# root . info ( '3. a' ) #NEWLINE# ea = daarrays . ea #NEWLINE# ea . append ( ( np . ones ( ( 1 , 10 ) ) * idx ) ) #NEWLINE# root . info ( '4. sequential' ) #NEWLINE# vla = daarrays . vla #NEWLINE# vla . append ( ( np . ones ( ( idx + 2 ) ) * idx ) ) #NEWLINE# root . info ( '5. Block' ) #NEWLINE# the_range = list ( range ( max ( 0 , ( idx - ( 2 * ncores ) ) ) , max ( 0 , idx ) ) ) #NEWLINE# for irun in the_range : #NEWLINE# #INDENT# ( x , y ) = ( a [ irun ] , irun ) #NEWLINE# if ( ( x != y ) and ( x != 0 ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'ERROR in write_into_shared_storage %s != %s' % ( str ( x ) , str ( y ) ) ) ) #NEWLINE# #UNINDENT# ( x , y ) = ( ca [ irun ] , irun ) #NEWLINE# if ( ( x != y ) and ( x != 0 ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'ERROR in write_into_shared_storage %s != %s' % ( str ( x ) , str ( y ) ) ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( x , y ) = ( ea [ ( irun , 9 ) ] , ea [ ( irun , 8 ) ] ) #NEWLINE# if ( ( x != y ) and ( x != 0 ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'ERROR in write_into_shared_storage %s != %s' % ( str ( x ) , str ( y ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except IndexError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( x , y ) = ( vla [ irun ] [ 0 ] , vla [ irun ] [ 1 ] ) #NEWLINE# if ( ( x != y ) and ( x != 0 ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'ERROR in write_into_shared_storage %s != %s' % ( str ( x ) , str ( y ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except IndexError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# root . info ( '6. !!!!!!!!!' ) #NEWLINE# tabs = traj . tabs #NEWLINE# with StorageContextManager ( traj ) as cm : #NEWLINE# #INDENT# t1 = tabs . t1 #NEWLINE# row = t1 . row #NEWLINE# row [ 'run_name' ] = compat . tobytes ( traj . v_crun ) #NEWLINE# row [ 'idx' ] = idx #NEWLINE# row . append ( ) #NEWLINE# t1 . flush ( ) #NEWLINE# #UNINDENT# t2 = tabs . t2 #NEWLINE# row = t2 [ idx ] #NEWLINE# if ( row [ 'run_name' ] != compat . tobytes ( traj . v_crun ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'Names in run table do not match, Run: %s != %s' % ( row [ 'run_name' ] , traj . v_crun ) ) ) #NEWLINE# #UNINDENT# df = traj . df #NEWLINE# df . append ( pd . DataFrame ( { #NEWLINE# #INDENT# 'idx' : [ traj . v_idx ] , #NEWLINE# 'run_name' : traj . v_crun , #NEWLINE# #UNINDENT# } ) )