Possible Fixes
This commit is contained in:
@@ -3,21 +3,39 @@ import time
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
import gc
|
||||
import shutil
|
||||
|
||||
from retinaface import RetinaFace
|
||||
|
||||
treashold = float(os.getenv('FACE_TRASHOLD', '0.9'))
|
||||
sever = os.getenv('API_ROOT', 'localhost:8000')
|
||||
disk_treashold = os.getenv('DISK_FREE_TRASHOLD', 'localhost:8000')
|
||||
|
||||
root_api_url = 'http://{}/local'.format(sever)
|
||||
base_path = '/app/data/'
|
||||
total, used, free = shutil.disk_usage(base_path)
|
||||
|
||||
print("API_ROOT: " + str(root_api_url), flush=True)
|
||||
print("FACE_TRASHOLD: " + str(treashold), flush=True)
|
||||
|
||||
|
||||
print("DISK_FREE_TRASHOLD: " + str(disk_treashold), flush=True)
|
||||
|
||||
try:
|
||||
while True:
|
||||
print("LOOP Started !!!", flush=True)
|
||||
|
||||
#Chesk if there is enought free space at destination path
|
||||
while True:
|
||||
if (free // (2**30)) > 10:
|
||||
break
|
||||
|
||||
data = {"trace": "not enought free space at destination" + str(base_path) + " trashold is: " + str(disk_treashold) + "%"}
|
||||
response = requests.post('{}/log'.format(root_api_url), json=data)
|
||||
|
||||
print("sleep", flush=True)
|
||||
time.sleep(900)
|
||||
|
||||
# Load Records to be anonimized
|
||||
r = requests.get('{}/anonymize'.format(root_api_url))
|
||||
# print(r.text, flush=True)
|
||||
response = r.json()
|
||||
@@ -82,6 +100,8 @@ try:
|
||||
print(str(detection['id']) + " Anonymized" , flush=True)
|
||||
time.sleep(10)
|
||||
|
||||
print("Clearing Memory", flush=True)
|
||||
gc.collect()
|
||||
print("sleep", flush=True)
|
||||
time.sleep(900)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user