From 7cfdea2305ef9d6ed3befe629c276cf744c54a7f Mon Sep 17 00:00:00 2001 From: fnets Date: Fri, 21 Feb 2025 11:34:00 -0600 Subject: [PATCH] task/WP-834 - Add behavior for ignoring DesignSafe-Corral allocation for running jobs (#1057) * Added changes to remove TAS projects that are purely administrative from default allocations, as they were preventing a few users from running jobs. * Update server/portal/apps/users/views.py --------- Co-authored-by: Chandra Y Co-authored-by: Garrett Edmonds <43251554+edmondsgarrett@users.noreply.github.com> --- server/portal/apps/users/views.py | 5 +++++ server/portal/settings/settings.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/server/portal/apps/users/views.py b/server/portal/apps/users/views.py index 3946233fe..486f46f0f 100644 --- a/server/portal/apps/users/views.py +++ b/server/portal/apps/users/views.py @@ -130,6 +130,11 @@ def get(self, request): """ data = get_allocations(request.user.username) + # This line iterates through all the projects in the active allocations and filters out the ones that are excluded in settings. + filtered_projects = [project for project in data["active"] if project.get("projectName") not in settings.ALLOCATIONS_TO_EXCLUDE] + + data["active"] = filtered_projects + return JsonResponse({"response": data}) diff --git a/server/portal/settings/settings.py b/server/portal/settings/settings.py index 09d7ef2d2..27dbb186e 100644 --- a/server/portal/settings/settings.py +++ b/server/portal/settings/settings.py @@ -607,6 +607,10 @@ def portal_filter(record): PORTAL_APPS_DEFAULT_TAB = getattr(settings_custom, '_PORTAL_APPS_DEFAULT_TAB', '') +ALLOCATIONS_TO_EXCLUDE = ( + getattr(settings_custom, "_ALLOCATIONS_TO_EXCLUDE", ["DesignSafe-DCV", "DesignSafe-Corral"]) +) + PORTAL_JOB_NOTIFICATION_STATES = ["PENDING", "STAGING_INPUTS", "RUNNING", "ARCHIVING", "BLOCKED", "PAUSED", "FINISHED", "CANCELLED", "FAILED"] WH_BASE_URL = getattr(settings_custom, '_WH_BASE_URL', '')