[Erp5-report] r46044 romain - /erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jul 31 13:27:21 CEST 2012


Author: romain
Date: Tue Jul 31 13:27:20 2012
New Revision: 46044

URL: http://svn.erp5.org?rev=46044&view=rev
Log:
Drop base_url parameter.

Tidstorage now directly connects to the ZEO servers.

Modified:
    erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/tidstorage.py

Modified: erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/tidstorage.py
URL: http://svn.erp5.org/erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/tidstorage.py?rev=46044&r1=46043&r2=46044&view=diff
==============================================================================
--- erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/tidstorage.py [utf8] (original)
+++ erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/bin/tidstorage.py [utf8] Tue Jul 31 13:27:20 2012
@@ -449,53 +449,48 @@ class BootstrapContent(threading.Thread)
       Contact all zopes to serialize all their storages.
     """
     global has_bootstraped
-    base_url = options.base_url
-    if base_url is not None:
-      log('Bootstrap started')
-      storage_id_to_object_path_dict = {}
-      for key, value in options.known_tid_storage_identifier_dict.iteritems():
-        mountpoint = value[2]
-        if mountpoint is None:
-          log('Skipping bootstrap of storage %s because its mountpoint is unknown.' % (key, ))
-        else:
-          storage_id_to_object_path_dict[key] = mountpoint
-      target_storage_id_set = sets.ImmutableSet(storage_id_to_object_path_dict.keys())
+    log('Bootstrap started')
+    storage_id_to_object_path_dict = {}
+    for key, value in options.known_tid_storage_identifier_dict.iteritems():
+      mountpoint = value[2]
+      if mountpoint is None:
+        log('Skipping bootstrap of storage %s because its mountpoint is unknown.' % (key, ))
+      else:
+        storage_id_to_object_path_dict[key] = mountpoint
+    target_storage_id_set = sets.ImmutableSet(storage_id_to_object_path_dict.keys())
+    known_storage_id_set = sets.ImmutableSet(tid_storage.dump_transcient().keys())
+    to_check_storage_id_set = target_storage_id_set - known_storage_id_set
+    while len(to_check_storage_id_set) and can_bootstrap:
+      serialize_url = None
+      for storage_id in to_check_storage_id_set:
+        if can_bootstrap and storage_id not in tid_storage.dump_transcient().keys():
+          try:
+            # Query a Zeo. The patched transaction will contact this process 
+            # in return to store the new TID number, making the given storage
+            # known.
+            address_list, zeo_storage_id = json.loads(storage_id)
+            zeo_client_storage = ClientStorage.ClientStorage(
+              ((address_list[0][0].encode('UTF-8'), address_list[0][1]),),
+              zeo_storage_id.encode('UTF-8'))
+            db = DB(zeo_client_storage)
+            conn = db.open()
+            root = conn.root()
+            root._p_changed = 1
+            transaction.commit()
+          except Exception, message:
+            log('Exception during bootstrap (%r):\n%s' % (storage_id, ''.join(traceback.format_exception(*sys.exc_info()))))
+          else:
+            log('Opened %r' % storage_id)
+      # Let some time for zope to contact TIDStorage back and fill the gaps.
+      time.sleep(5)
       known_storage_id_set = sets.ImmutableSet(tid_storage.dump_transcient().keys())
       to_check_storage_id_set = target_storage_id_set - known_storage_id_set
-      while len(to_check_storage_id_set) and can_bootstrap:
-        serialize_url = None
-        for storage_id in to_check_storage_id_set:
-          if can_bootstrap and storage_id not in tid_storage.dump_transcient().keys():
-            try:
-              # Query a Zeo. The patched transaction will contact this process 
-              # in return to store the new TID number, making the given storage
-              # known.
-              address_list, zeo_storage_id = json.loads(storage_id)
-              zeo_client_storage = ClientStorage.ClientStorage(
-                ((address_list[0][0].encode('UTF-8'), address_list[0][1]),),
-                zeo_storage_id.encode('UTF-8'))
-              db = DB(zeo_client_storage)
-              conn = db.open()
-              root = conn.root()
-              root._p_changed = 1
-              transaction.commit()
-            except Exception, message:
-              log('Exception during bootstrap (%r):\n%s' % (storage_id, ''.join(traceback.format_exception(*sys.exc_info()))))
-            else:
-              log('Opened %r' % storage_id)
-        # Let some time for zope to contact TIDStorage back and fill the gaps.
-        time.sleep(5)
-        known_storage_id_set = sets.ImmutableSet(tid_storage.dump_transcient().keys())
-        to_check_storage_id_set = target_storage_id_set - known_storage_id_set
-        if len(to_check_storage_id_set):
-          log('Bootstrap in progress... Missing storages: %r' % (to_check_storage_id_set, ))
-          # Retry a bit later
-          time.sleep(60)
-      if len(to_check_storage_id_set) == 0:
-        log('Bootstrap done (%i storages).' % (len(target_storage_id_set), ))
-        has_bootstraped = True
-    else:
-      log('Bootstrap did not happen because base_url was not given.')
+      if len(to_check_storage_id_set):
+        log('Bootstrap in progress... Missing storages: %r' % (to_check_storage_id_set, ))
+        # Retry a bit later
+        time.sleep(60)
+    if len(to_check_storage_id_set) == 0:
+      log('Bootstrap done (%i storages).' % (len(target_storage_id_set), ))
       has_bootstraped = True
 
 bootstrap_content = BootstrapContent()
@@ -628,7 +623,7 @@ Usage: %(arg0)s [-h] [-n|--nofork|--fg] 
   --config file_name
     Use given file as options file.
     It must be a python file. See sample_options.py for possible values.
-    If provided and if configuration file defines base_url and
+    If provided and if configuration file defines
     known_tid_storage_identifier_dict variables, this program will cause
     generation of all tids before first write to status file.
 """ % {'arg0': sys.argv[0],
@@ -649,7 +644,6 @@ class Options:
   burst_period = None
   full_dump_period = None
   known_tid_storage_identifier_dict = {}
-  base_url = None
 
 config_file_name = None
 



More information about the Erp5-report mailing list