AnandInguva commented on code in PR #26603:
URL: https://github.com/apache/beam/pull/26603#discussion_r1192682455


##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -836,7 +838,12 @@ def get_metrics_collector(self, prefix: str = ''):
 
   def setup(self):
     self._metrics_collector = self.get_metrics_collector()
-    self._model_handler.set_environment_vars()
+    try:
+      self._model_handler.set_environment_vars()
+    except AttributeError:
+      logging.warning(
+          "ModelHander should call super().__init__ or set _env_vars.")

Review Comment:
   We are checking `if '_env_vars` in self.__dict__ in ModelHandler's 
set_environment_vars, if that attribute is not in the dict, then we skip it 
right? 
   But we expect that case to show warning right but it actually doesn't 



##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -836,7 +838,12 @@ def get_metrics_collector(self, prefix: str = ''):
 
   def setup(self):
     self._metrics_collector = self.get_metrics_collector()
-    self._model_handler.set_environment_vars()
+    try:
+      self._model_handler.set_environment_vars()
+    except AttributeError:
+      logging.warning(
+          "ModelHander should call super().__init__ or set _env_vars.")

Review Comment:
   We are checking `if '_env_vars in self.__dict__` in ModelHandler's 
set_environment_vars, if that attribute is not in the dict, then we skip it 
right? 
   But we expect that case to show warning right but it actually doesn't 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to