class_docstr: A wrapper class that allows for easy interaction with a Study.
docstr: Gets a list of suggested Trials.
  
  Args:
      client_id: An ID that identifies the `Tuner` requesting a `Trial`.
          `Tuners` that should run the same trial (for instance, when
          running a multi-worker model) should have the same ID. If
          multiple suggestTrialsRequests have the same tuner_id, the
          service will return the identical suggested trial if the trial
          is PENDING, and provide a new trial if the last suggest trial
          was completed.
      suggestion_count: The number of suggestions to request.
  
  Returns:
    A list of Trials (represented by JSON dicts). This may be an empty
    list if:
    1. A finite search space has been exhausted.
    2. If max_num_trials = 1000 has been reached.
    3. Or if there are no longer any trials that match a supplied Context.
  
  Raises:
      SuggestionInactiveError: Indicates that a suggestion was requested
          from an inactive study. Note that this is NOT raised when a
          finite Study runs out of suggestions. In such a case, an empty
          list is returned.
docstr_tok: ["Gets","a","list","of","suggested","Trials",".","Args",":","client_id",":","An","ID","that","identifies","the","`","Tuner","`","requesting","a","`","Trial","`",".","`","Tuners","`","that","should","run","the","same","trial","(","for","instance",",","when","running","a","multi-worker","model",")","should","have","the","same","ID",".","If","multiple","suggestTrialsRequests","have","the","same","tuner_id",",","the","service","will","return","the","identical","suggested","trial","if","the","trial","is","PENDING",",","and","provide","a","new","trial","if","the","last","suggest","trial","was","completed",".","suggestion_count",":","The","number","of","suggestions","to","request",".","Returns",":","A","list","of","Trials","(","represented","by","JSON","dicts",")",".","This","may","be","an","empty","list","if",":","1",".","A","finite","search","space","has","been","exhausted",".","2",".","If","max_num_trials","=","1000","has","been","reached",".","3",".","Or","if","there","are","no","longer","any","trials","that","match","a","supplied","Context",".","Raises",":","SuggestionInactiveError",":","Indicates","that","a","suggestion","was","requested","from","an","inactive","study",".","Note","that","this","is","NOT","raised","when","a","finite","Study","runs","out","of","suggestions",".","In","such","a","case",",","an","empty","list","is","returned","."]
code: def get_suggestions(
      self,
      client_id: Text,
      suggestion_count: int = constants.SUGGESTION_COUNT_PER_REQUEST,
  ) -> List[Dict[Text, Any]]:
      """Gets a list of suggested Trials.
  
      Args:
          client_id: An ID that identifies the `Tuner` requesting a `Trial`.
              `Tuners` that should run the same trial (for instance, when
              running a multi-worker model) should have the same ID. If
              multiple suggestTrialsRequests have the same tuner_id, the
              service will return the identical suggested trial if the trial
              is PENDING, and provide a new trial if the last suggest trial
              was completed.
          suggestion_count: The number of suggestions to request.
  
      Returns:
        A list of Trials (represented by JSON dicts). This may be an empty
        list if:
        1. A finite search space has been exhausted.
        2. If max_num_trials = 1000 has been reached.
        3. Or if there are no longer any trials that match a supplied Context.
  
      Raises:
          SuggestionInactiveError: Indicates that a suggestion was requested
              from an inactive study. Note that this is NOT raised when a
              finite Study runs out of suggestions. In such a case, an empty
              list is returned.
      """
      # Requests a trial.
      try:
          resp = (
              self.service_client.projects()
              .locations()
              .studies()
              .trials()
              .suggest(
                  parent=self._make_study_name(),
                  body={
                      "client_id": client_id,
                      "suggestion_count": suggestion_count,
                  },
              )
              .execute()
          )
      except errors.HttpError as e:
          if e.resp.status == 429:
              # Status 429 'RESOURCE_EXAUSTED' is raised when trials more than
              # the maximum limit (1000) of the Vizier service for a study
              # are requested, or the number of finite search space.
              # For distributed tuning, a tuner worker may request the 1001th
              # trial, while the other tuner worker has not completed training
              # the 1000th trial, and triggers this error.
              tf.get_logger().info("Reached max number of trials.")
              return []
          else:
              tf.get_logger().info("SuggestTrial failed.")
              raise e
  
      # Polls the suggestion of long-running operations.
      tf.get_logger().info("CreateTrial: polls the suggestions.")
      operation = self._obtain_long_running_operation(resp)
  
      suggestions = operation["response"]
  
      if "trials" not in suggestions:
          if operation["response"]["studyState"] == "INACTIVE":
              raise SuggestionInactiveError(
                  "The study is stopped due to an internal error."
              )
      return suggestions["trials"]
  
imports: import datetime
  import http
  import json
  import time
  from typing import Any, Dict, List, Mapping, Optional, Text, Union
  from googleapiclient import discovery
  from googleapiclient import errors
  import tensorflow
  from tensorflow_cloud.tuner import vizier_client_interface
  from tensorflow_cloud.tuner import constants
  from tensorflow_cloud.utils import google_api_client
label_desc: Use image node_id 2 for calling the _VizierClient obj's underlying member method code with example usage: obj.get_suggestions(client_id, suggestion_count) and returns: suggestions, list