riteshghorse commented on code in PR #28564:
URL: https://github.com/apache/beam/pull/28564#discussion_r1344557204


##########
sdks/python/apache_beam/transforms/environments.py:
##########
@@ -124,9 +124,9 @@ def __init__(self,
         dict(resource_hints) if resource_hints else {})
 
   def __eq__(self, other):
+    # don't compare artifacts since they have different hashes in their names.
     return (
-        self.__class__ == other.__class__ and
-        self._artifacts == other._artifacts

Review Comment:
   I agree that if two environment have different dependencies then they are 
not equal. But unit tests where we compare the two environments will fail (For 
example: 
[EnvironmentOptionsTest::test_environments_with_same_hints_are_equal](https://github.com/apache/beam/blob/12b071402035a0404c4f6e4a83124b3839b5de40/sdks/python/apache_beam/transforms/environments_test.py#L121))
 with the addition of a new staging file. Even though this file is same, it has 
a a different hash in name:
   ```
   first: [type_urn: "beam:artifact:type:file:v1"
   type_payload: 
"\nd/var/folders/kk/jk392txd7x14sg93r8sjnzkh00tp20/T/tmpmxw3v4d9/submission_environment_dependencies.txt"
   role_urn: "beam:artifact:role:staging_to:v1"
   role_payload: "\n\'submission_environment_dependencies.txt"
   ]
   second: [type_urn: "beam:artifact:type:file:v1"
   type_payload: 
"\nd/var/folders/kk/jk392txd7x14sg93r8sjnzkh00tp20/T/tmpni8k_038/submission_environment_dependencies.txt"
   role_urn: "beam:artifact:role:staging_to:v1"
   role_payload: "\n\'submission_environment_dependencies.txt"
   ]
   ```
   
   
   



-- 
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