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


The following commit(s) were added to refs/heads/develop by this push:
     new 528996cd Make sure request info gets into error emails
528996cd is described below

commit 528996cd6ecbb3aa4a8c96c7ee3057ff730c0810
Author: Marcus Christie <[email protected]>
AuthorDate: Mon Apr 10 15:29:29 2023 -0400

    Make sure request info gets into error emails
---
 django_airavata/apps/api/views.py       | 12 ++++++------
 django_airavata/apps/auth/backends.py   |  2 +-
 django_airavata/apps/workspace/views.py |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/django_airavata/apps/api/views.py 
b/django_airavata/apps/api/views.py
index b8f22d87..eae9595a 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -240,7 +240,7 @@ class ExperimentViewSet(mixins.CreateModelMixin,
             experiment_util.launch(request, experiment_id)
             return Response({'success': True})
         except Exception as e:
-            log.exception(f"Failed to launch experiment {experiment_id}")
+            log.exception(f"Failed to launch experiment {experiment_id}", 
extra={'request': request})
             return Response({'success': False, 'errorMessage': str(e)})
 
     @action(methods=['get'], detail=True)
@@ -267,7 +267,7 @@ class ExperimentViewSet(mixins.CreateModelMixin,
                 request.authz_token, experiment_id, self.gateway_id)
             return Response({'success': True})
         except Exception as e:
-            log.exception("Cancel action has thrown the following error")
+            log.exception("Cancel action has thrown the following error", 
extra={'request': request})
             raise e
 
     @action(methods=['post'], detail=True)
@@ -279,7 +279,7 @@ class ExperimentViewSet(mixins.CreateModelMixin,
                 request, experiment_id, *request.data["outputNames"])
             return Response({'success': True})
         except Exception as e:
-            log.exception("fetchIntermediateOutputs failed with the following 
error")
+            log.exception("fetchIntermediateOutputs failed with the following 
error", extra={'request': request})
             raise e
 
     def _update_workspace_preferences(self, project_id,
@@ -382,7 +382,7 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
                 log.warning(
                     "Cannot load application model since app interface failed 
to load")
         except Exception:
-            log.exception("Failed to load app interface/module")
+            log.exception("Failed to load app interface/module", 
extra={'request': self.request})
 
         compute_resource_id = None
         user_conf = experimentModel.userConfigurationData
@@ -395,7 +395,7 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
                 if compute_resource_id else None
         except Exception:
             log.exception("Failed to load compute resource for {}".format(
-                compute_resource_id))
+                compute_resource_id), extra={'request': self.request})
             compute_resource = None
         if self.request.airavata_client.userHasAccess(
                 self.authz_token,
@@ -464,7 +464,7 @@ class ApplicationModuleViewSet(APIBackedViewSet):
         elif len(app_interfaces) > 1:
             log.error(
                 "More than one application interface found for module {}: {}"
-                .format(app_module_id, app_interfaces))
+                .format(app_module_id, app_interfaces), extra={'request': 
request})
             raise Exception(
                 'More than one application interface found for module {}'
                 .format(app_module_id)
diff --git a/django_airavata/apps/auth/backends.py 
b/django_airavata/apps/auth/backends.py
index 3a59fb66..1987e4b7 100644
--- a/django_airavata/apps/auth/backends.py
+++ b/django_airavata/apps/auth/backends.py
@@ -335,4 +335,4 @@ class KeycloakBackend(object):
                 utils.send_admin_alert_about_uninitialized_username(
                     request, user.username, user.email, user.first_name, 
user.last_name)
             except Exception:
-                logger.exception(f"Failed to send alert about username being 
uninitialized: {user.username}")
+                logger.exception(f"Failed to send alert about username being 
uninitialized: {user.username}", extra={'request': request})
diff --git a/django_airavata/apps/workspace/views.py 
b/django_airavata/apps/workspace/views.py
index bd3ca291..0c85df71 100644
--- a/django_airavata/apps/workspace/views.py
+++ b/django_airavata/apps/workspace/views.py
@@ -100,9 +100,9 @@ def create_experiment(request, app_module_id):
                             user_input_values[app_input['name']] = dp_uri
                     except Exception:
                         logger.exception(
-                            f"Failed checking data product uri: {dp_uri}")
+                            f"Failed checking data product uri: {dp_uri}", 
extra={'request': request})
             except ValueError:
-                logger.exception(f"Invalid user file value: {user_file_value}")
+                logger.exception(f"Invalid user file value: 
{user_file_value}", extra={'request': request})
         elif (app_input['type'] == DataType.STRING and
               app_input['name'] in request.GET):
             name = app_input['name']

Reply via email to