This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 2a63b583725ca2d28d5936c55080a155e6c0f713
Author: Marcus Christie <[email protected]>
AuthorDate: Mon Apr 17 18:00:55 2023 -0400

    AIRAVATA-3694 Documented new user data archive settings
---
 django_airavata/apps/admin/management/commands/archive_user_data.py | 6 +++---
 django_airavata/settings.py                                         | 6 ++++--
 django_airavata/settings_local.py.sample                            | 5 ++++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/django_airavata/apps/admin/management/commands/archive_user_data.py 
b/django_airavata/apps/admin/management/commands/archive_user_data.py
index da59960f..b09fbaa1 100644
--- a/django_airavata/apps/admin/management/commands/archive_user_data.py
+++ b/django_airavata/apps/admin/management/commands/archive_user_data.py
@@ -28,11 +28,11 @@ class Command(BaseCommand):
 
     def handle(self, *args, **options):
         try:
-            max_age_setting = getattr(settings, 
"GATEWAY_USER_DATA_ARCHIVE_MAX_AGE", None)
+            max_age_setting = getattr(settings, 
"GATEWAY_USER_DATA_ARCHIVE_MAX_AGE_DAYS", None)
             if max_age_setting is None:
-                raise CommandError("Setting GATEWAY_USER_DATA_ARCHIVE_MAX_AGE 
is not configured")
+                raise CommandError("Setting 
GATEWAY_USER_DATA_ARCHIVE_MAX_AGE_DAYS is not configured")
 
-            max_age = timezone.now() - datetime.timedelta(**max_age_setting)
+            max_age = timezone.now() - datetime.timedelta(days=max_age_setting)
             entries_to_archive = self.get_archive_entries(older_than=max_age)
             gateway_id = settings.GATEWAY_ID
 
diff --git a/django_airavata/settings.py b/django_airavata/settings.py
index a415a5be..0e293a9b 100644
--- a/django_airavata/settings.py
+++ b/django_airavata/settings.py
@@ -203,9 +203,11 @@ TUS_ENDPOINT = None
 # Override and set to the directory where tus uploads will be stored
 TUS_DATA_DIR = None
 
-# TODO: document, timedelta arguments
-GATEWAY_USER_DATA_ARCHIVE_MAX_AGE = None
+# Max age in days after which archive_user_data will archive user data
+GATEWAY_USER_DATA_ARCHIVE_MAX_AGE_DAYS = None
+# Directory in which to copy archive text listing file and tarball
 GATEWAY_USER_DATA_ARCHIVE_DIRECTORY = "/tmp"
+# Minimum size of archive file. If archive is smaller than this, the archive 
is aborted.
 GATEWAY_USER_DATA_ARCHIVE_MINIMUM_ARCHIVE_SIZE_GB = 1
 
 # Legacy (PGA) Portal link - provide a link to the legacy portal
diff --git a/django_airavata/settings_local.py.sample 
b/django_airavata/settings_local.py.sample
index a21bf826..c5e9cb80 100644
--- a/django_airavata/settings_local.py.sample
+++ b/django_airavata/settings_local.py.sample
@@ -117,8 +117,11 @@ PROFILE_SERVICE_SECURE = False
 
 # Gateway user data archive configuration. User data can be periodically
 # archived and deleted to free up storage space.
-# GATEWAY_USER_DATA_ARCHIVE_MAX_AGE = {'days': 90}
+# Max age in days after which archive_user_data will archive user data
+# GATEWAY_USER_DATA_ARCHIVE_MAX_AGE_DAYS = 90
+# Directory in which to copy archive text listing file and tarball
 # GATEWAY_USER_DATA_ARCHIVE_DIRECTORY = "/path/dir/where/to/copy/archives"
+# Minimum size of archive file. If archive is smaller than this, the archive 
is aborted.
 # GATEWAY_USER_DATA_ARCHIVE_MINIMUM_ARCHIVE_SIZE_GB = 1
 
 # Portal settings

Reply via email to