[galaxy-commits] commit/galaxy-central: natefoo: Rename HierarchicalObjectStore to DistributedObjectStore.

Bitbucket commits-noreply at bitbucket.org
Thu Dec 8 17:47:14 EST 2011


1 new commit in galaxy-central:


https://bitbucket.org/galaxy/galaxy-central/changeset/7611d5d306bb/
changeset:   7611d5d306bb
user:        natefoo
date:        2011-12-08 23:46:59
summary:     Rename HierarchicalObjectStore to DistributedObjectStore.
affected #:  5 files

diff -r c6735493b09f507e02564e6c79f9fef39d7bf7fa -r 7611d5d306bb462c803b36d236cebf874ba9e1b8 distributed_object_store_conf.xml.sample
--- /dev/null
+++ b/distributed_object_store_conf.xml.sample
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<backends>
+    <backend name="files1" type="disk" weight="1">
+        <files_dir path="database/files1"/>
+        <extra_dir type="temp" path="database/tmp1"/>
+        <extra_dir type="job_work" path="database/job_working_directory1"/>
+    </backend>
+    <backend name="files2" type="disk" weight="1">
+        <files_dir path="database/files2"/>
+        <extra_dir type="temp" path="database/tmp2"/>
+        <extra_dir type="job_work" path="database/job_working_directory2"/>
+    </backend>
+</backends>


diff -r c6735493b09f507e02564e6c79f9fef39d7bf7fa -r 7611d5d306bb462c803b36d236cebf874ba9e1b8 hierarchical_object_store_conf.xml.sample
--- a/hierarchical_object_store_conf.xml.sample
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<backends>
-    <backend name="files1" type="disk" weight="1">
-        <files_dir path="database/files1"/>
-        <extra_dir type="temp" path="database/tmp1"/>
-        <extra_dir type="job_work" path="database/job_working_directory1"/>
-    </backend>
-    <backend name="files2" type="disk" weight="1">
-        <files_dir path="database/files2"/>
-        <extra_dir type="temp" path="database/tmp2"/>
-        <extra_dir type="job_work" path="database/job_working_directory2"/>
-    </backend>
-</backends>


diff -r c6735493b09f507e02564e6c79f9fef39d7bf7fa -r 7611d5d306bb462c803b36d236cebf874ba9e1b8 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -156,7 +156,7 @@
         self.s3_bucket = kwargs.get( 's3_bucket', None)
         self.use_reduced_redundancy = kwargs.get( 'use_reduced_redundancy', False )
         self.object_store_cache_size = float(kwargs.get( 'object_store_cache_size', -1 ))
-        self.hierarchical_object_store_config_file = kwargs.get( 'hierarchical_object_store_config_file', None )
+        self.distributed_object_store_config_file = kwargs.get( 'distributed_object_store_config_file', None )
         # Parse global_conf and save the parser
         global_conf = kwargs.get( 'global_conf', None )
         global_conf_parser = ConfigParser.ConfigParser()


diff -r c6735493b09f507e02564e6c79f9fef39d7bf7fa -r 7611d5d306bb462c803b36d236cebf874ba9e1b8 lib/galaxy/objectstore/__init__.py
--- a/lib/galaxy/objectstore/__init__.py
+++ b/lib/galaxy/objectstore/__init__.py
@@ -854,7 +854,7 @@
         return None
 
 
-class HierarchicalObjectStore(ObjectStore):
+class DistributedObjectStore(ObjectStore):
     """
     ObjectStore that defers to a list of backends, for getting objects the
     first store where the object exists is used, objects are created in a
@@ -862,22 +862,22 @@
     """
     
     def __init__(self, config):
-        super(HierarchicalObjectStore, self).__init__()
-        assert config is not None, "hierarchical object store ('object_store = hierarchical') " \
+        super(DistributedObjectStore, self).__init__()
+        assert config is not None, "distributed object store ('object_store = distributed') " \
                                    "requires a config file, please set one in " \
-                                   "'hierarchical_object_store_config_file')"
-        self.hierarchical_config = config
+                                   "'distributed_object_store_config_file')"
+        self.distributed_config = config
         self.backends = {}
         self.weighted_backend_names = []
 
         random.seed()
 
-        self.__parse_hierarchical_config(config)
+        self.__parse_distributed_config(config)
 
-    def __parse_hierarchical_config(self, config):
-        tree = util.parse_xml(self.hierarchical_config)
+    def __parse_distributed_config(self, config):
+        tree = util.parse_xml(self.distributed_config)
         root = tree.getroot()
-        log.debug('Loading backends for hierarchical object store from %s' % self.hierarchical_config)
+        log.debug('Loading backends for distributed object store from %s' % self.distributed_config)
         for elem in [ e for e in root if e.tag == 'backend' ]:
             name = elem.get('name')
             weight = int(elem.get('weight', 1))
@@ -980,6 +980,16 @@
                 return store
         return None
 
+class HierarchicalObjectStore(ObjectStore):
+    """
+    ObjectStore that defers to a list of backends, for getting objects the
+    first store where the object exists is used, objects are always created
+    in the first store.
+    """
+    
+    def __init__(self, backends=[]):
+        super(HierarchicalObjectStore, self).__init__()
+
 def build_object_store_from_config(config):
     """ Depending on the configuration setting, invoke the appropriate object store
     """
@@ -990,8 +1000,10 @@
         os.environ['AWS_ACCESS_KEY_ID'] = config.aws_access_key
         os.environ['AWS_SECRET_ACCESS_KEY'] = config.aws_secret_key
         return S3ObjectStore(config=config)
+    elif store == 'distributed':
+        return DistributedObjectStore(config.distributed_object_store_config_file)
     elif store == 'hierarchical':
-        return HierarchicalObjectStore(config.hierarchical_object_store_config_file)
+        return HierarchicalObjectStore()
 
 def convert_bytes(bytes):
     """ A helper function used for pretty printing disk usage """


diff -r c6735493b09f507e02564e6c79f9fef39d7bf7fa -r 7611d5d306bb462c803b36d236cebf874ba9e1b8 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -437,7 +437,7 @@
 
 # -- Beta features
 
-# Object store mode (valid options are: disk, s3, hierarchical)
+# Object store mode (valid options are: disk, s3, distributed, hierarchical)
 #object_store = s3
 #aws_access_key = <AWS access key>
 #aws_secret_key = <AWS secret key>

Repository URL: https://bitbucket.org/galaxy/galaxy-central/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the galaxy-commits mailing list