tvalentyn commented on a change in pull request #14390:
URL: https://github.com/apache/beam/pull/14390#discussion_r616801819



##########
File path: sdks/python/apache_beam/runners/pipeline_context.py
##########
@@ -274,5 +283,36 @@ def to_runner_api(self):
     return context_proto
 
   def default_environment_id(self):
-    # type: () -> Optional[str]
+    # type: () -> str
     return self._default_environment_id
+
+  def get_environment_id_for_resource_hints(
+      self, hints):  # type: (Dict[str, bytes]) -> str
+    """Returns an environment id that has necessary resource hints."""
+    if not hints:
+      return self.default_environment_id()
+
+    def get_or_create_environment_with_resource_hints(
+        template_env_id,
+        resource_hints,
+    ):  # type: (str, Dict[str, bytes]) -> str
+      """Creates an environment that has necessary hints and returns its id."""
+      template_env = self.environments.get_proto_from_id(template_env_id)
+      cloned_env = type(template_env)(
+      )  # type: beam_runner_api_pb2.Environment  # type: ignore
+      cloned_env.CopyFrom(template_env)
+      cloned_env.resource_hints.clear()
+      for hint, value in resource_hints.items():

Review comment:
       it does, thanks.




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

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


Reply via email to