Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEA-187 Add disk usage to SEA action metadata #275

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,11 @@ scipy==1.10.1
# via
# -r requirements.txt
# scos-actions
scos-actions @ git+https://github.com/NTIA/scos-actions@8.0.0
scos-actions @ git+https://github.com/NTIA/scos-actions@SEA-187-add-disk-usage
# via
# -r requirements.txt
# scos-tekrsa
scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@5.0.0
scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@SEA-187-add-disk-usage
# via -r requirements.txt
sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive
# via
Expand Down
2 changes: 1 addition & 1 deletion src/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ packaging>=23.0, <24.0
psycopg2-binary>=2.0, <3.0
requests-mock>=1.0, <2.0
requests_oauthlib>=1.0, <2.0
scos_tekrsa @ git+https://github.com/NTIA/scos-tekrsa@5.0.0
scos_tekrsa @ git+https://github.com/NTIA/scos-tekrsa@SEA-187-add-disk-usage

# The following are sub-dependencies for which SCOS Sensor enforces a
# higher minimum patch version than the dependencies which require them.
Expand Down
4 changes: 2 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ ruamel-yaml-clib==0.2.8
# via ruamel-yaml
scipy==1.10.1
# via scos-actions
scos-actions @ git+https://github.com/NTIA/scos-actions@8.0.0
scos-actions @ git+https://github.com/NTIA/scos-actions@SEA-187-add-disk-usage
# via scos-tekrsa
scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@5.0.0
scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@SEA-187-add-disk-usage
# via -r requirements.in
sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive
# via scos-actions
Expand Down
11 changes: 2 additions & 9 deletions src/status/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from scos_actions.utils import (
convert_datetime_to_millisecond_iso_format,
get_datetime_str_now,
get_disk_usage,
)

from initialization import sensor_loader, status_monitor
Expand All @@ -32,14 +33,6 @@ def serialize_location():
return None


def disk_usage():
"""Return the total disk usage as a percentage."""
usage = shutil.disk_usage("/")
percent_used = round(100 * usage.used / usage.total)
logger.debug(str(percent_used) + " disk used")
return round(percent_used, 2)


def get_days_up():
"""Return the number of days SCOS has been running."""
elapsed = datetime.datetime.utcnow() - start_time
Expand All @@ -57,7 +50,7 @@ def status(request, version, format=None):
"location": serialize_location(),
"system_time": get_datetime_str_now(),
"start_time": convert_datetime_to_millisecond_iso_format(start_time),
"disk_usage": disk_usage(),
"disk_usage": get_disk_usage(),
"days_up": get_days_up(),
}
if (
Expand Down
Loading