update docker.py

This commit is contained in:
童颖佳 2023-03-15 14:26:03 +08:00 committed by GitHub
parent 24d7e70d47
commit aeb37cbc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,8 +31,9 @@ def check_vm_resource(app_name):
cpu_count = p.cpu_count()
mem = p.virtual_memory()
mem_total = float(mem.total) / 1024 / 1024 / 1024
need_cpu_count = int(read_var(app_name, 'cpu'))
need_mem = int(read_var(app_name, 'memory'))
requirements_var = read_var(app_name, 'requirements')
need_cpu_count = int(requirements_var['cpu'])
need_mem = int(requirements_var['memory'])
if cpu_count<need_cpu_count or mem_total<need_mem:
return False
@ -40,7 +41,7 @@ def check_vm_resource(app_name):
if mem_total>=8 and mem_free<=4:
return False
need_disk = int(read_var(app_name, 'disk'))
need_disk = int(requirements_var['disk'])
disk = p.disk_usage('/')
disk_total = float(disk.total) / 1024 / 1024 / 1024
disk_free = float(disk.free) / 1024 / 1024 / 1024