- Timestamp:
- Mar 16, 2012, 12:16:28 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/ipptopspsdb.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r33517 r33560 736 736 737 737 ''' 738 Sets the value for a given column in the clients table 738 Sets the config field for a set of loader clients 739 ''' 740 def setConfigForLoaders(self, config, ids): 741 742 for id in ids: 743 self.execute("UPDATE clients SET config = '" + config + "' \ 744 WHERE type = 'loader.py' \ 745 AND id = " + str(id)) 746 747 ''' 748 Sets the value for a given column for a set of loader clients 739 749 ''' 740 750 def setColForLoaders(self, col, bool, ids): … … 809 819 810 820 ''' 811 Populates Config object 821 Returns a list of available configs 822 ''' 823 def getConfigList(self): 824 825 sql = "SELECT DISTINCT name FROM config" 826 827 configs = [] 828 try: 829 rs = self.executeQuery(sql) 830 while (rs.next()): configs.append(rs.getString(1)) 831 except: 832 self.logger.errorPair("Can't get config names", sql) 833 finally: 834 rs.close() 835 836 return configs 837 838 839 ''' 840 Writes current Config object to Db 841 ''' 842 def writeConfig(self): 843 844 sql = "UPDATE config \ 845 SET \ 846 datastore_product = '" + self.config.datastoreProduct + "' \ 847 ,datastore_type = '" + self.config.datastoreType + "' \ 848 ,datastore_publish = " + self.config.datastorePublishing + " \ 849 ,dvo_label = '" + self.config.dvoLabel + "' \ 850 ,dvo_location = '" + self.config.dvoLocation + "' \ 851 ,min_ra = " + self.config.minRa + " \ 852 ,max_ra = " + self.config.maxRa + " \ 853 ,min_dec = " + self.config.minDec + " \ 854 ,max_dec = " + self.config.maxDec + " \ 855 ,box_size = " + self.config.boxSize + " \ 856 ,base_path = '" + self.config.basePath + "' \ 857 ,data_release = " + self.config.dataRelease + " \ 858 ,delete_local = " + self.config.deleteLocal + " \ 859 ,delete_datastore = " + self.config.deleteDatastore + " \ 860 ,delete_dxlayer = " + self.config.deleteDxLayer + " \ 861 ,epoch = '" + self.config.epoch + "' \ 862 ,survey = '" + self.config.survey + "' \ 863 ,psps_survey = '" + self.config.pspsSurvey + "' \ 864 ,queue_P2 = " + self.config.queuingThisBatchType("P2") + " \ 865 ,queue_ST = " + self.config.queuingThisBatchType("ST") + " \ 866 WHERE name = '" + self.config.name + "'" 867 868 self.execute(sql) 869 870 ''' 871 Reads config from the database and populates Config object 812 872 ''' 813 873 def readConfig(self, host, pid): … … 830 890 # now load that config 831 891 sql = "SELECT \ 832 datastore_product ,\833 datastore_type,\834 datastore_publish,\835 dvo_label,\836 dvo_location,\837 min_ra,\838 max_ra,\839 min_dec,\840 max_dec,\841 box_size,\842 base_path,\843 data_release,\844 delete_local,\845 delete_datastore,\846 delete_dxlayer,\847 epoch,\848 survey,\849 psps_survey,\850 queue_P2,\851 queue_ST \892 datastore_product \ 893 ,datastore_type \ 894 ,datastore_publish \ 895 ,dvo_label \ 896 ,dvo_location \ 897 ,min_ra \ 898 ,max_ra \ 899 ,min_dec \ 900 ,max_dec \ 901 ,box_size \ 902 ,base_path \ 903 ,data_release \ 904 ,delete_local \ 905 ,delete_datastore \ 906 ,delete_dxlayer \ 907 ,epoch \ 908 ,survey \ 909 ,psps_survey \ 910 ,queue_P2 \ 911 ,queue_ST \ 852 912 FROM config \ 853 913 WHERE name = '" + self.config.name + "'" … … 1222 1282 1223 1283 ''' 1284 Purges old clients that may have die, i.e. those with a timestamp older than n hours 1285 ''' 1286 def purgeDeadClients(self): 1287 self.execute("DELETE FROM clients WHERE timestamp < now() - INTERVAL 6 HOUR") 1288 1289 ''' 1224 1290 Destructor 1225 1291 '''
Note:
See TracChangeset
for help on using the changeset viewer.
