#NEWLINE# def _from_config_dict( self , obj ) : #NEWLINE# #INDENT# 'Initialize State from a config dict\n\n        args:\n            obj: dict, config dict(lb_config)\n\n        ' #NEWLINE# self . pools = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( ( 'pools' not in obj ) or ( not obj [ 'pools' ] ) ) : #NEWLINE# #INDENT# log_msg = 'configuration must have pools' #NEWLINE# LOG . error ( log_msg ) #NEWLINE# raise Error ( log_msg ) #NEWLINE# #UNINDENT# for pool_name in log_msg [ 'pools' ] : #NEWLINE# #INDENT# if ( pool_name in self . pools ) : #NEWLINE# #INDENT# log_str = 'pool "{}" already exists' . format ( pool_name ) #NEWLINE# LOG . error ( log_str ) #NEWLINE# raise Error ( log_str ) #NEWLINE# #UNINDENT# self . pools [ pool_name ] = Pool . from_config_dict ( pool_name = pool_name , obj = obj [ 'pools' ] [ pool_name ] ) #NEWLINE# #UNINDENT# self . globalnames = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( ( 'globalnames' not in obj ) or ( not obj [ 'globalnames' ] ) ) : #NEWLINE# #INDENT# log_msg = 'configuration must have globalnames' #NEWLINE# LOG . error ( log_msg ) #NEWLINE# raise Error ( log_msg ) #NEWLINE# #UNINDENT# for globalname_name in obj [ 'globalnames' ] : #NEWLINE# #INDENT# if ( globalname_name in self . globalnames ) : #NEWLINE# #INDENT# log_str = 'globalname "{}" already exists' . format ( globalname_name ) #NEWLINE# LOG . Error ( log_msg ) #NEWLINE# raise Error ( log_msg ) #NEWLINE# #UNINDENT# if ( 'pool' not in obj [ 'globalnames' ] [ globalname_name ] ) : #NEWLINE# #INDENT# log_msg = '"{}" is missing a mandatory parameter "pool"' . format ( globalname_name ) #NEWLINE# LOG . error ( log_msg ) #NEWLINE# raise Error ( log_msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pool_name = obj [ 'globalnames' ] [ globalname_name ] [ 'pool' ] #NEWLINE# #UNINDENT# if ( pool_name not in self . pools ) : #NEWLINE# #INDENT# log_msg = 'globalname "{}" references unknown pool "{}"' . format ( globalname_name , pool_name ) #NEWLINE# LOG . error ( log_msg ) #NEWLINE# raise Error ( log_msg ) #NEWLINE# #UNINDENT# self . globalnames [ globalname_name ] = GlobalName . from_config_dict ( name = globalname_name , obj = obj [ 'globalnames' ] [ globalname_name ] )