Garbage Collector
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
circle/storage/tasks/periodic_tasks.py
8 logger = logging.getLogger(__name__) 9 10 11 @celery.task 12 def garbage_collector(): 13 logging.warning("Deletable disks:") 14 for ds in DataStore.objects.all(): 15 one_week_before = timezone.now() - timedelta(days=7) 16 file_list = os.listdir(ds.path) 17 disk_list = [disk.filename for disk in 18 ds.disk_set.filter(destroyed__lt=one_week_before)] 19 for i in set(file_list).intersection(disk_list): 20 abs_path = ds.path + "/" + i 21 logging.warning(i + " - " + 22 str(os.path.getsize(abs_path) / 1024 / 1024)) 23 #os.unlink(abs_path) -
Őry Máté @orymate commentedOwner
We could maybe move them to a separate folder (if we are afraid of data loss)?
We could maybe move them to a separate folder (if we are afraid of data loss)? -
Őry Máté @orymate commentedOwner
ok
ok
Please register or sign in to reply -
-
circle/storage/tasks/periodic_tasks.py
16 file_list = os.listdir(ds.path) 17 disk_list = [disk.filename for disk in 18 ds.disk_set.filter(destroyed__lt=one_week_before)] 19 for i in set(file_list).intersection(disk_list): 20 abs_path = ds.path + "/" + i 21 logging.warning(i + " - " + 22 str(os.path.getsize(abs_path) / 1024 / 1024)) 23 #os.unlink(abs_path) 24 25 logging.warning("Orphan disks:") 26 for ds in DataStore.objects.all(): 27 one_week_before = timezone.now() - timedelta(days=7) 28 file_list = os.listdir(ds.path) 29 disk_list = [disk.filename for disk in ds.disk_set.all()] 30 for i in set(file_list).difference(disk_list): 31 if "dump" not in i: -
Őry Máté @orymate commentedOwner
This can be theoretically true for an uuid
This can be theoretically true for an uuid -
Őry Máté @orymate commentedOwner
ok
ok
-
-
circle/storage/tasks/periodic_tasks.py
15 one_week_before = timezone.now() - timedelta(days=7) 16 file_list = os.listdir(ds.path) 17 disk_list = [disk.filename for disk in 18 ds.disk_set.filter(destroyed__lt=one_week_before)] 19 for i in set(file_list).intersection(disk_list): 20 abs_path = ds.path + "/" + i 21 logging.warning(i + " - " + 22 str(os.path.getsize(abs_path) / 1024 / 1024)) 23 #os.unlink(abs_path) 24 25 logging.warning("Orphan disks:") 26 for ds in DataStore.objects.all(): 27 one_week_before = timezone.now() - timedelta(days=7) 28 file_list = os.listdir(ds.path) 29 disk_list = [disk.filename for disk in ds.disk_set.all()] 30 for i in set(file_list).difference(disk_list): -
Őry Máté @orymate commentedOwner
set - set
is a much more readable syntax.`set - set` is a much more readable syntax. -
Őry Máté @orymate commentedOwner
-
-
circle/storage/tasks/periodic_tasks.py
28 file_list = os.listdir(ds.path) 29 disk_list = [disk.filename for disk in ds.disk_set.all()] 30 for i in set(file_list).difference(disk_list): 31 if "dump" not in i: 32 abs_path = ds.path + "/" + i 33 logging.warning(i + " - " + 34 str(os.path.getsize(abs_path) / 1024 / 1024)) 35 36 logging.warning("Missing disks:") 37 for ds in DataStore.objects.all(): 38 one_week_before = timezone.now() - timedelta(days=7) 39 file_list = os.listdir(ds.path) 40 disk_list = [disk.filename for disk in 41 ds.disk_set.filter(destroyed__isnull=False)] 42 for i in set(disk_list).difference(file_list): 43 logging.warning(i) -
Őry Máté @orymate commentedOwner
Critical? What can we do at all?
Critical? What can we do at all? -
Őry Máté @orymate commentedOwner
ok
ok
-
-
circle/storage/tasks/periodic_tasks.py
19 for i in set(file_list).intersection(disk_list): 20 abs_path = ds.path + "/" + i 21 logging.warning(i + " - " + 22 str(os.path.getsize(abs_path) / 1024 / 1024)) 23 #os.unlink(abs_path) 24 25 logging.warning("Orphan disks:") 26 for ds in DataStore.objects.all(): 27 one_week_before = timezone.now() - timedelta(days=7) 28 file_list = os.listdir(ds.path) 29 disk_list = [disk.filename for disk in ds.disk_set.all()] 30 for i in set(file_list).difference(disk_list): 31 if "dump" not in i: 32 abs_path = ds.path + "/" + i 33 logging.warning(i + " - " + 34 str(os.path.getsize(abs_path) / 1024 / 1024)) -
Őry Máté @orymate commentedOwner
What can we do? How does a disk become orphan?
What can we do? How does a disk become orphan? -
Őry Máté @orymate commentedOwner
ok
ok
-
-
circle/storage/tasks/periodic_tasks.py
5 from manager.mancelery import celery 6 import logging 7 8 logger = logging.getLogger(__name__) 9 10 11 @celery.task 12 def garbage_collector(): 13 logging.warning("Deletable disks:") 14 for ds in DataStore.objects.all(): 15 one_week_before = timezone.now() - timedelta(days=7) 16 file_list = os.listdir(ds.path) 17 disk_list = [disk.filename for disk in 18 ds.disk_set.filter(destroyed__lt=one_week_before)] 19 for i in set(file_list).intersection(disk_list): 20 abs_path = ds.path + "/" + i -
Őry Máté @orymate commentedOwner
path.join
?`path.join`? -
Őry Máté @orymate commentedOwner
removed
removed
-
-
-
Őry Máté @orymate
mentioned in merge request !9 (merged)
-