mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3263 from zfrenchee/patch-1
Azure - Leasing container sometimes breaks things in docker galaxy
This commit is contained in:
@@ -44,7 +44,6 @@ class AzureBlobObjectStore(ObjectStore):
|
||||
self.transfer_progress = 0
|
||||
self._parse_config_xml(config_xml)
|
||||
self._configure_connection()
|
||||
self.container_lease = self._get_container_lease()
|
||||
|
||||
# Clean cache only if value is set in galaxy.ini
|
||||
if self.cache_size != -1:
|
||||
@@ -89,28 +88,6 @@ class AzureBlobObjectStore(ObjectStore):
|
||||
self.account = CloudStorageAccount(self.account_name, self.account_key)
|
||||
self.service = self.account.create_block_blob_service()
|
||||
|
||||
def _get_container_lease(self):
|
||||
""" Sometimes a handle to a container is not established right away so try
|
||||
it a few times. Raise error is connection is not established. """
|
||||
for i in range(5):
|
||||
try:
|
||||
self.service.break_container_lease(self.container_name)
|
||||
container_lease = self.service.acquire_container_lease(self.container_name)
|
||||
log.debug("Using azure blob store with container '%s'", self.container_name)
|
||||
return container_lease
|
||||
except AzureHttpError:
|
||||
try:
|
||||
log.debug("container not found, creating azure blob store container with name '%s'", self.container_name)
|
||||
self.service.create_container(self.container_name)
|
||||
container_lease = self.service.acquire_container_lease(self.container_name)
|
||||
return container_lease
|
||||
except AzureHttpError:
|
||||
log.exception("Could not get container '%s', attempt %s/5", self.container_name, i + 1)
|
||||
time.sleep(2)
|
||||
# All the attempts have been exhausted and connection was not established,
|
||||
# raise error
|
||||
raise AzureHttpError
|
||||
|
||||
def _construct_path(self, obj, base_dir=None, dir_only=None, extra_dir=None, extra_dir_at_root=False, alt_name=None, obj_dir=False, **kwargs):
|
||||
# extra_dir should never be constructed from provided data but just
|
||||
# make sure there are no shenannigans afoot
|
||||
|
||||
Reference in New Issue
Block a user