Merge remote-tracking branch 'upstream/v2-phase4' into python-registry-v2
This commit is contained in:
commit
e7a6176594
105 changed files with 4439 additions and 2074 deletions
|
@ -10,12 +10,12 @@ logger = logging.getLogger(__name__)
|
|||
class GarbageCollectionWorker(Worker):
|
||||
def __init__(self):
|
||||
super(GarbageCollectionWorker, self).__init__()
|
||||
self.add_operation(self._garbage_collection_repos, 10)
|
||||
self.add_operation(self._garbage_collection_repos, 30)
|
||||
|
||||
def _garbage_collection_repos(self):
|
||||
""" Performs garbage collection on repositories. """
|
||||
with UseThenDisconnect(app.config):
|
||||
repository = find_repository_with_garbage(app.config.get('EXP_ASYNC_GARBAGE_COLLECTION', []))
|
||||
repository = find_repository_with_garbage()
|
||||
if repository is None:
|
||||
logger.debug('No repository with garbage found')
|
||||
return
|
||||
|
|
|
@ -8,8 +8,11 @@ from datetime import datetime, timedelta
|
|||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
from app import app
|
||||
|
||||
from data.model import db
|
||||
from data.queue import WorkQueue
|
||||
from data.database import UseThenDisconnect
|
||||
|
||||
from workers.worker import Worker
|
||||
|
||||
|
@ -123,7 +126,8 @@ class QueueWorker(Worker):
|
|||
logger.debug('No more work.')
|
||||
|
||||
def update_queue_metrics(self):
|
||||
self._queue.update_metrics()
|
||||
with UseThenDisconnect(app.config):
|
||||
self._queue.update_metrics()
|
||||
|
||||
def mark_current_incomplete(self, restore_retry=False):
|
||||
with self._current_item_lock:
|
||||
|
|
|
@ -49,9 +49,7 @@ class StorageReplicationWorker(QueueWorker):
|
|||
logger.debug('Copying image storage %s to location %s', partial_storage.uuid, location)
|
||||
|
||||
# Copy the various paths.
|
||||
paths = [storage_paths.image_json_path,
|
||||
storage_paths.image_ancestry_path,
|
||||
storage_paths.image_layer_path]
|
||||
paths = [storage_paths.v1_image_layer_path]
|
||||
|
||||
try:
|
||||
for path_builder in paths:
|
||||
|
@ -75,8 +73,21 @@ class StorageReplicationWorker(QueueWorker):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not features.STORAGE_REPLICATION:
|
||||
logger.debug('Full storage replication disabled; skipping')
|
||||
logging.config.fileConfig('conf/logging.conf', disable_existing_loggers=False)
|
||||
|
||||
has_local_storage = False
|
||||
|
||||
if features.STORAGE_REPLICATION:
|
||||
for storage_type, _ in app.config.get('DISTRIBUTED_STORAGE_CONFIG', {}).values():
|
||||
if storage_type == 'LocalStorage':
|
||||
has_local_storage = True
|
||||
break
|
||||
|
||||
if not features.STORAGE_REPLICATION or has_local_storage:
|
||||
if has_local_storage:
|
||||
logger.error("Storage replication can't be used with local storage")
|
||||
else:
|
||||
logger.debug('Full storage replication disabled; skipping')
|
||||
while True:
|
||||
time.sleep(10000)
|
||||
|
||||
|
|
Reference in a new issue