mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-09-29 16:21:32 +00:00
update docker.py
This commit is contained in:
parent
24d7e70d47
commit
aeb37cbc82
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue