3535from fandango .log import Logger
3636import fandango .functional as fun
3737from fandango .functional import ( isString ,isSequence ,isCallable ,
38- str2time , str2epoch , clmatch , time2str , epoch2str ,
38+ str2time , str2epoch , clmatch , time2str , epoch2str , now ,
3939 ctime2time , mysql2time , NaN )
4040from fandango .dicts import CaselessDict , SortedDict
4141from fandango .linos import check_process ,get_memory
@@ -712,14 +712,17 @@ def get_extractor(self,check=True,attribute=''):
712712 @Cached (depth = 10 ,expire = 15. )
713713 def get_attributes (self ,active = False ):
714714 """ Queries the database for the current list of archived attributes."""
715+ self .log .debug ('get_attributes(%s)' % active )
716+ t0 = now ()
715717 #Try Unified Reader
716718 if self .db_name == '*' :
717719 attrs = []
718- for x in self .configs .values ():
720+ for c , x in self .configs .items ():
719721 try :
720- for a in x .get_attributes (active = active ):
722+ for i , a in enumerate ( x .get_attributes (active = active ) ):
721723 m = parse_tango_model (a )
722724 attrs .append ((m .simplename ,m .model )[self .multihost ])
725+ self .log .info ('\t %s: %s' % (c ,i + 1 ))
723726 except :
724727 self .log .debug (traceback .format_exc ())
725728 return sorted (set (attrs ))
@@ -732,6 +735,7 @@ def get_attributes(self,active=False):
732735 'last update was at %s' % (time .ctime (),self .schema ,self .updated ))
733736
734737 if self .get_database (): #Using a database Query
738+ t1 = now ()
735739 self .available_attributes = \
736740 self .get_database ().get_attribute_names (active = False )
737741 self .current_attributes = \
@@ -742,16 +746,18 @@ def get_attributes(self,active=False):
742746 self .__extractorCommand (self .get_extractor (),
743747 'GetCurrentArchivedAtt' )
744748
749+ t1 = now ()
745750 self .available_attributes = [(m .simplename ,m .model )[self .multihost ]
746751 for m in (parse_tango_model (a ) for a in self .available_attributes )]
747752 self .current_attributes = [(m .simplename ,m .model )[self .multihost ]
748753 for m in (parse_tango_model (a ) for a in self .current_attributes )]
754+ self .log .info ('parse models: + %d s' % (now ()- t1 ))
749755
750- self .updated = time . time ()
756+ self .updated = now ()
751757
752758 self .log .debug ('In Reader(%s).get_attributes(): '
753- '%s attributes available in the database'
754- % (self .schema ,len (self .available_attributes )))
759+ '%s attributes available in the database (+%ds) '
760+ % (self .schema ,len (self .available_attributes ), self . updated - t0 ))
755761
756762 return (self .available_attributes ,self .current_attributes )[active ]
757763
0 commit comments