Possible Fixes
This commit is contained in:
@@ -3,21 +3,39 @@ import time
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
import gc
|
||||||
|
import shutil
|
||||||
|
|
||||||
from retinaface import RetinaFace
|
from retinaface import RetinaFace
|
||||||
|
|
||||||
treashold = float(os.getenv('FACE_TRASHOLD', '0.9'))
|
treashold = float(os.getenv('FACE_TRASHOLD', '0.9'))
|
||||||
sever = os.getenv('API_ROOT', 'localhost:8000')
|
sever = os.getenv('API_ROOT', 'localhost:8000')
|
||||||
|
disk_treashold = os.getenv('DISK_FREE_TRASHOLD', 'localhost:8000')
|
||||||
|
|
||||||
root_api_url = 'http://{}/local'.format(sever)
|
root_api_url = 'http://{}/local'.format(sever)
|
||||||
base_path = '/app/data/'
|
base_path = '/app/data/'
|
||||||
|
total, used, free = shutil.disk_usage(base_path)
|
||||||
|
|
||||||
print("API_ROOT: " + str(root_api_url), flush=True)
|
print("API_ROOT: " + str(root_api_url), flush=True)
|
||||||
print("FACE_TRASHOLD: " + str(treashold), flush=True)
|
print("FACE_TRASHOLD: " + str(treashold), flush=True)
|
||||||
|
print("DISK_FREE_TRASHOLD: " + str(disk_treashold), flush=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print("LOOP Started !!!", flush=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))
|
r = requests.get('{}/anonymize'.format(root_api_url))
|
||||||
# print(r.text, flush=True)
|
# print(r.text, flush=True)
|
||||||
response = r.json()
|
response = r.json()
|
||||||
@@ -82,6 +100,8 @@ try:
|
|||||||
print(str(detection['id']) + " Anonymized" , flush=True)
|
print(str(detection['id']) + " Anonymized" , flush=True)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
print("Clearing Memory", flush=True)
|
||||||
|
gc.collect()
|
||||||
print("sleep", flush=True)
|
print("sleep", flush=True)
|
||||||
time.sleep(900)
|
time.sleep(900)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user