kopia lustrzana https://github.com/OpenDroneMap/WebODM
Use plugin's psutil
rodzic
726ae46886
commit
f6114c0544
|
@ -2,12 +2,12 @@ from rest_framework.response import Response
|
||||||
from rest_framework import status, permissions
|
from rest_framework import status, permissions
|
||||||
from rest_framework.decorators import api_view, permission_classes
|
from rest_framework.decorators import api_view, permission_classes
|
||||||
|
|
||||||
from app.plugins import PluginBase, Menu, MountPoint
|
from app.plugins import PluginBase, Menu, MountPoint, get_current_plugin
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
import json, shutil, psutil
|
import json, shutil
|
||||||
|
|
||||||
def get_memory_stats():
|
def get_memory_stats():
|
||||||
"""
|
"""
|
||||||
|
@ -35,6 +35,10 @@ def get_memory_stats():
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_diagnostic_stats():
|
def get_diagnostic_stats():
|
||||||
|
plugin = get_current_plugin()
|
||||||
|
with plugin.python_imports():
|
||||||
|
import psutil
|
||||||
|
|
||||||
# Disk space
|
# Disk space
|
||||||
total_disk_space, used_disk_space, free_disk_space = shutil.disk_usage('./')
|
total_disk_space, used_disk_space, free_disk_space = shutil.disk_usage('./')
|
||||||
|
|
||||||
|
|
|
@ -63,4 +63,3 @@ eventlet==0.32.0 ; sys_platform == "win32"
|
||||||
pyopenssl==19.1.0 ; sys_platform == "win32"
|
pyopenssl==19.1.0 ; sys_platform == "win32"
|
||||||
numpy==1.21.1
|
numpy==1.21.1
|
||||||
drf-yasg==1.20.0
|
drf-yasg==1.20.0
|
||||||
psutil==5.9.5
|
|
||||||
|
|
Ładowanie…
Reference in New Issue