class_docstr: CometLoggerCallback for logging Tune results to Comet.
  
  Comet (https://comet.ml/site/) is a tool to manage and optimize the
  entire ML lifecycle, from experiment tracking, model optimization
  and dataset versioning to model production monitoring.
  
  This Ray Tune ``LoggerCallback`` sends metrics and parameters to
  Comet for tracking.
  
  In order to use the CometLoggerCallback you must first install Comet
  via ``pip install comet_ml``
  
  Then set the following environment variables
  ``export COMET_API_KEY=<Your API Key>``
  
  Alternatively, you can also pass in your API Key as an argument to the
  CometLoggerCallback constructor.
  
  ``CometLoggerCallback(api_key=<Your API Key>)``
  
  Args:
          online: Whether to make use of an Online or
              Offline Experiment. Defaults to True.
          tags: Tags to add to the logged Experiment.
              Defaults to None.
          save_checkpoints: If ``True``, model checkpoints will be saved to
              Comet ML as artifacts. Defaults to ``False``.
          **experiment_kwargs: Other keyword arguments will be passed to the
              constructor for comet_ml.Experiment (or OfflineExperiment if
              online=False).
  
  Please consult the Comet ML documentation for more information on the
  Experiment and OfflineExperiment classes: https://comet.ml/site/
  
  Example:
  
  .. code-block:: python
  
      from ray.air.integrations.comet import CometLoggerCallback
      tune.run(
          train,
          config=config
          callbacks=[CometLoggerCallback(
              True,
              ['tag1', 'tag2'],
              workspace='my_workspace',
              project_name='my_project_name'
              )]
      )
class_docstr_tok: ["CometLoggerCallback","for","logging","Tune","results","to","Comet",".","Comet","(","https",":","\/\/comet.ml\/site\/",")","is","a","tool","to","manage","and","optimize","the","entire","ML","lifecycle",",","from","experiment","tracking",",","model","optimization","and","dataset","versioning","to","model","production","monitoring",".","This","Ray","Tune","``","LoggerCallback","``","sends","metrics","and","parameters","to","Comet","for","tracking",".","In","order","to","use","the","CometLoggerCallback","you","must","first","install","Comet","via","``","pip","install","comet_ml","``","Then","set","the","following","environment","variables","``","export","COMET_API_KEY=","<","Your","API","Key",">","``","Alternatively",",","you","can","also","pass","in","your","API","Key","as","an","argument","to","the","CometLoggerCallback","constructor",".","``","CometLoggerCallback","(","api_key=","<","Your","API","Key",">",")","``","Args",":","online",":","Whether","to","make","use","of","an","Online","or","Offline","Experiment",".","Defaults","to","True",".","tags",":","Tags","to","add","to","the","logged","Experiment",".","Defaults","to","None",".","save_checkpoints",":","If","``","True","``",",","model","checkpoints","will","be","saved","to","Comet","ML","as","artifacts",".","Defaults","to","``","False","``",".","*","*","experiment_kwargs",":","Other","keyword","arguments","will","be","passed","to","the","constructor","for","comet_ml.Experiment","(","or","OfflineExperiment","if","online=False",")",".","Please","consult","the","Comet","ML","documentation","for","more","information","on","the","Experiment","and","OfflineExperiment","classes",":","https",":","\/\/comet.ml\/site\/","Example",":","..","code-block",":",":","python","from","ray.air.integrations.comet","import","CometLoggerCallback","tune.run","(","train",",","config=config","callbacks=","[","CometLoggerCallback","(","True",",","[","'tag1","'",",","'tag2","'","]",",","workspace='my_workspace","'",",","project_name='my_project_name'",")","]",")"]
docstr: Log the current result of a Trial upon each iteration.
docstr_tok: ["Log","the","current","result","of","a","Trial","upon","each","iteration","."]
code: def log_trial_result(
      self, iteration: int, trial: "Trial", result: Dict
  ):
      """
      Log the current result of a Trial upon each iteration.
      """
      if trial not in self._trial_experiments:
          self.log_trial_start(trial)
      experiment = self._trial_experiments[trial]
      step = result["training_iteration"]
  
      config_update = result.pop("config", {}).copy()
      config_update.pop("callbacks", None)  # Remove callbacks
      for k, v in config_update.items():
          if isinstance(v, dict):
              experiment.log_parameters(
                  flatten_dict({k: v}, "/"), step=step
              )
  
          else:
              experiment.log_parameter(k, v, step=step)
  
      other_logs = {}
      metric_logs = {}
      system_logs = {}
      episode_logs = {}
  
      flat_result = flatten_dict(result, delimiter="/")
      for k, v in flat_result.items():
          if any(
              self._check_key_name(k, item) for item in self._to_exclude
          ):
              continue
  
          if any(
              self._check_key_name(k, item) for item in self._to_other
          ):
              other_logs[k] = v
  
          elif any(
              self._check_key_name(k, item) for item in self._to_system
          ):
              system_logs[k] = v
  
          elif any(
              self._check_key_name(k, item)
              for item in self._to_episodes
          ):
              episode_logs[k] = v
  
          else:
              metric_logs[k] = v
  
      experiment.log_others(other_logs)
      experiment.log_metrics(metric_logs, step=step)
  
      for k, v in system_logs.items():
          experiment.log_system_info(k, v)
  
      for k, v in episode_logs.items():
          experiment.log_curve(k, x=range(len(v)), y=v, step=step)
  
file_path: ray/python/ray/air/integrations/comet.py
imports: import os
  from typing import Dict, List
  import pyarrow.fs
  from ray.tune.logger import LoggerCallback
  from ray.tune.experiment import Trial
  from ray.tune.utils import flatten_dict
label_desc: Use image node_id 5 for calling the CometLoggerCallback obj's underlying member method code with example usage: obj.log_trial_result(iteration, trial, result) without return types