class_docstr: Keras Tuner Oracle that wraps the AI Platform Vizier backend.
  
  This is an implementation of `KerasTuner` Oracle that uses Google Cloud's
  Vizier Service.
  
  Each Oracle class implements a particular hyperparameter tuning algorithm.
  An Oracle is passed as an argument to a Tuner. The Oracle tells the Tuner
  which hyperparameters should be tried next.
  
  To learn more about Keras Tuner Oracles please refer to:
  https://keras-team.github.io/keras-tuner/documentation/oracles/
  
  AI Platform Vizier is a black-box optimization service that helps you tune
  hyperparameters in complex machine learning (ML) models. When ML models have
  many different hyperparameters, it can be difficult and time consuming to
  tune them manually. AI Platform Vizier optimizes your model's output by
  tuning the hyperparameters for you.
  To learn more about AI Platform Vizier service see:
      https://cloud.google.com/ai-platform/optimizer/docs/overview.
  
  Examples:
  
  ```
  oracle = CloudOracle(
      project_id=project_id,
      region='us-central1',
      objective='accuracy',
      hyperparameters=hyperparameters,
      study_config=None,
      max_trials=4,
      study_id=None,
  )
  ```
class_docstr_tok: ["Keras","Tuner","Oracle","that","wraps","the","AI","Platform","Vizier","backend",".","This","is","an","implementation","of","`","KerasTuner","`","Oracle","that","uses","Google","Cloud's","Vizier","Service",".","Each","Oracle","class","implements","a","particular","hyperparameter","tuning","algorithm",".","An","Oracle","is","passed","as","an","argument","to","a","Tuner",".","The","Oracle","tells","the","Tuner","which","hyperparameters","should","be","tried","next",".","To","learn","more","about","Keras","Tuner","Oracles","please","refer","to",":","https",":","\/\/keras-team.github.io\/keras-tuner\/documentation\/oracles\/","AI","Platform","Vizier","is","a","black-box","optimization","service","that","helps","you","tune","hyperparameters","in","complex","machine","learning","(","ML",")","models",".","When","ML","models","have","many","different","hyperparameters",",","it","can","be","difficult","and","time","consuming","to","tune","them","manually",".","AI","Platform","Vizier","optimizes","your","model","'s","output","by","tuning","the","hyperparameters","for","you",".","To","learn","more","about","AI","Platform","Vizier","service","see",":","https",":","\/\/cloud.google.com\/ai-platform\/optimizer\/docs\/overview",".","Examples",":","``","`","oracle","=","CloudOracle","(","project_id=project_id",",","region='us-central1","'",",","objective='accuracy","'",",","hyperparameters=hyperparameters",",","study_config=None",",","max_trials=4",",","study_id=None",",",")","``","`"]
docstr: Record the measured objective for a set of parameter values.
docstr_tok: ["Record","the","measured","objective","for","a","set","of","parameter","values","."]
code: def end_trial(
      self, trial_id: Text, status: Text = "COMPLETED", message=None
  ):
      """Record the measured objective for a set of parameter values."""
      keras_tuner_trial = None
      for tuner_id, ongoing_trial in self.ongoing_trials.items():
          if ongoing_trial.trial_id == trial_id:
              tf.get_logger().info(
                  "End trial requested by tuner ({})".format(tuner_id)
              )
              keras_tuner_trial = self.ongoing_trials.pop(tuner_id)
              break
  
      if not keras_tuner_trial:
          raise ValueError(
              "Ongoing trial with id: {} not found.".format(trial_id)
          )
  
      keras_tuner_trial.status = status
      if status == trial_module.TrialStatus.COMPLETED:
          trial_infeasible = False
          infeasibility_reason = None
      elif status == trial_module.TrialStatus.INVALID:
          trial_infeasible = True
          infeasibility_reason = status
      else:
          raise ValueError(
              'Unexpected status passed. Expected "COMPLETED" or '
              '"INVALID", found {}'.format(status)
          )
  
      vizier_trial = self.service.complete_trial(
          trial_id, trial_infeasible, infeasibility_reason
      )
  
      if status == trial_module.TrialStatus.COMPLETED:
          final_measurement = vizier_trial["finalMeasurement"]
          # If epochs = 1, set the best_step = 0.
          keras_tuner_trial.best_step = int(
              final_measurement.get("stepCount", 0)
          )
          keras_tuner_trial.score = final_measurement["metrics"][0].get(
              "value"
          )
      self._save_trial(keras_tuner_trial)
      self.save()
  
imports: import collections
  import copy
  import datetime
  import os
  import time
  from typing import Any, Callable, Dict, List, Mapping, Optional, Text, Union
  from keras_tuner.engine import hypermodel
  from keras_tuner.engine import hyperparameters
  from keras_tuner.engine import metrics_tracking
  from keras_tuner.engine import oracle
  from keras_tuner.engine import trial
  from keras_tuner.engine import tuner
  import tensorflow
  from tensorboard.plugins.hparams import api
  from tensorflow_cloud.core import deploy
  from tensorflow_cloud.core import machine_config
  from tensorflow_cloud.core import validate
  from tensorflow_cloud.tuner import cloud_fit_client
  from tensorflow_cloud.tuner import utils
  from tensorflow_cloud.tuner import vizier_client
  from tensorflow_cloud.utils import google_api_client
  from tensorflow_cloud.utils import tf_utils
label_desc: Use image node_id 4 for calling the CloudOracle obj's underlying member method code with example usage: obj.end_trial(trial_id, status, message) without return types