class_docstr: Class that defines the methods necessary to hook into process.
class_docstr_tok: ["Class","that","defines","the","methods","necessary","to","hook","into","process","."]
code: def on_cmdline(self, cmd, *args):
      self.cometml_experiment = None
      if cmd in {"train", "experiment"}:
          # create a new experiment
          try:
              self.cometml_experiment = comet_ml.Experiment(
                  log_code=False
              )
          except Exception:
              logger.exception(
                  "comet_ml.Experiment() had errors. Perhaps you need to define COMET_API_KEY"
              )
              return
      elif cmd in {"visualize", "predict", "evaluate"}:
          # restore from an existing experiment
          try:
              self.cometml_experiment = comet_ml.ExistingExperiment()
          except Exception:
              logger.exception(
                  "Ignored --comet. No '.comet.config' file"
              )
              return
      else:
          # unhandled command
          return
  
      cli = self._make_command_line(cmd, args)
      self.cometml_experiment.set_code(cli)
      self.cometml_experiment.set_filename("Ludwig CLI")
      self._log_html(cli)
      config = comet_ml.get_config()
      self._save_config(config)
  
file_path: ludwig/ludwig/contribs/comet.py
imports: import logging
  import os
  from datetime import datetime
  from ludwig.api_annotations import PublicAPI
  from ludwig.callbacks import Callback
  from ludwig.utils.package_utils import LazyLoader
label_desc: Use image node_id 8 for calling the CometCallback obj's underlying member method code with example usage: obj.on_cmdline(cmd) without return types