class_docstr: Logger class for Comet integration
  
  `Comet <https://www.comet.ml/>`__ is a meta machine learning platform
  designed to help AI practitioners and teams build reliable machine learning
  models for real-world applications by streamlining the machine learning
  model lifecycle. By leveraging Comet, users can track, compare, explain and
  reproduce their machine learning experiments.
  
  To log a Spark NLP annotator, it will need an "outputLogPath" parameter, as the
  CometLogger reads the log file generated during the training process.
  
  For more examples see the `Examples
  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/logging/Comet_SparkNLP_Integration.ipynb>`__.
  
  Parameters
  ----------
  workspace : str, optional
      Name of the workspace in Comet, by default None
  project_name : str, optional
      Name of the project in Comet, by default None
  comet_mode : str, optional
      Mode of logging, by default None. If set to "offline" then offline mode
      will be used, otherwise online.
  experiment_id : str, optional
      Id of the experiment, if it is reused, by default None
  tags : List[str], optional
      List of tags for the experiment, by default None
  
  Attributes
  ----------
  experiment : comet_ml.Experiment
      Object representing the Comet experiment
  
  Raises
  ------
  ImportError
      If the package comet-ml is not installed
  
  Examples
  --------
  Metrics while training an annotator can be logged with for example:
  
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from sparknlp.logging.comet import CometLogger
  >>> spark = sparknlp.start()
  
  To run an online experiment, the logger is defined like so.
  
  >>> OUTPUT_LOG_PATH = "./run"
  >>> logger = CometLogger()
  
  Then the experiment can start like so
  
  >>> document = DocumentAssembler() \
  ...     .setInputCol("text")\
  ...     .setOutputCol("document")
  >>> embds = UniversalSentenceEncoder.pretrained() \
  ...     .setInputCols("document") \
  ...     .setOutputCol("sentence_embeddings")
  >>> multiClassifier = MultiClassifierDLApproach() \
  ...     .setInputCols("sentence_embeddings") \
  ...     .setOutputCol("category") \
  ...     .setLabelColumn("labels") \
  ...     .setBatchSize(128) \
  ...     .setLr(1e-3) \
  ...     .setThreshold(0.5) \
  ...     .setShufflePerEpoch(False) \
  ...     .setEnableOutputLogs(True) \
  ...     .setOutputLogsPath(OUTPUT_LOG_PATH) \
  ...     .setMaxEpochs(1)
  >>> logger.monitor(logdir=OUTPUT_LOG_PATH, model=multiClassifier)
  >>> trainDataset = spark.createDataFrame(
  ...     [("Nice.", ["positive"]), ("That's bad.", ["negative"])],
  ...     schema=["text", "labels"],
  ... )
  >>> pipeline = Pipeline(stages=[document, embds, multiClassifier])
  >>> pipeline.fit(trainDataset)
  >>> logger.end()
  
  If you are using a jupyter notebook, it is possible to display the live web
  interface with
  
  >>> logger.experiment.display(tab='charts')
class_docstr_tok: ["Logger","class","for","Comet","integration","`","Comet","<","https",":","\/\/www.comet.ml\/",">","`","__","is","a","meta","machine","learning","platform","designed","to","help","AI","practitioners","and","teams","build","reliable","machine","learning","models","for","real-world","applications","by","streamlining","the","machine","learning","model","lifecycle",".","By","leveraging","Comet",",","users","can","track",",","compare",",","explain","and","reproduce","their","machine","learning","experiments",".","To","log","a","Spark","NLP","annotator",",","it","will","need","an","``","outputLogPath","''","parameter",",","as","the","CometLogger","reads","the","log","file","generated","during","the","training","process",".","For","more","examples","see","the","`","Examples","<","https",":","\/\/github.com\/JohnSnowLabs\/spark-nlp\/blob\/master\/examples\/python\/logging\/Comet_SparkNLP_Integration.ipynb",">","`","__",".","Parameters","--","--","--","--","--","workspace",":","str",",","optional","Name","of","the","workspace","in","Comet",",","by","default","None","project_name",":","str",",","optional","Name","of","the","project","in","Comet",",","by","default","None","comet_mode",":","str",",","optional","Mode","of","logging",",","by","default","None",".","If","set","to","``","offline","''","then","offline","mode","will","be","used",",","otherwise","online",".","experiment_id",":","str",",","optional","Id","of","the","experiment",",","if","it","is","reused",",","by","default","None","tags",":","List","[","str","]",",","optional","List","of","tags","for","the","experiment",",","by","default","None","Attributes","--","--","--","--","--","experiment",":","comet_ml.Experiment","Object","representing","the","Comet","experiment","Raises","--","--","--","ImportError","If","the","package","comet-ml","is","not","installed","Examples","--","--","--","--","Metrics","while","training","an","annotator","can","be","logged","with","for","example",":",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","sparknlp.logging.comet","import","CometLogger",">",">",">","spark","=","sparknlp.start","(",")","To","run","an","online","experiment",",","the","logger","is","defined","like","so",".",">",">",">","OUTPUT_LOG_PATH","=","``",".\/run","''",">",">",">","logger","=","CometLogger","(",")","Then","the","experiment","can","start","like","so",">",">",">","document","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","embds","=","UniversalSentenceEncoder.pretrained","(",")","\\","...",".setInputCols","(","``","document","''",")","\\","...",".setOutputCol","(","``","sentence_embeddings","''",")",">",">",">","multiClassifier","=","MultiClassifierDLApproach","(",")","\\","...",".setInputCols","(","``","sentence_embeddings","''",")","\\","...",".setOutputCol","(","``","category","''",")","\\","...",".setLabelColumn","(","``","labels","''",")","\\","...",".setBatchSize","(","128",")","\\","...",".setLr","(","1e-3",")","\\","...",".setThreshold","(","0.5",")","\\","...",".setShufflePerEpoch","(","False",")","\\","...",".setEnableOutputLogs","(","True",")","\\","...",".setOutputLogsPath","(","OUTPUT_LOG_PATH",")","\\","...",".setMaxEpochs","(","1",")",">",">",">","logger.monitor","(","logdir=OUTPUT_LOG_PATH",",","model=multiClassifier",")",">",">",">","trainDataset","=","spark.createDataFrame","(","...","[","(","``","Nice",".","``",",","[","``","positive","''","]",")",",","(","``","That","'s","bad",".","``",",","[","``","negative","''","]",")","]",",","...","schema=","[","``","text","''",",","``","labels","''","]",",","...",")",">",">",">","pipeline","=","Pipeline","(","stages=","[","document",",","embds",",","multiClassifier","]",")",">",">",">","pipeline.fit","(","trainDataset",")",">",">",">","logger.end","(",")","If","you","are","using","a","jupyter","notebook",",","it","is","possible","to","display","the","live","web","interface","with",">",">",">","logger.experiment.display","(","tab='charts","'",")"]
docstr: Monitors the training of the model and submits logs to comet, given
  by an interval.
  
  To log a Spark NLP annotator, it will need an "outputLogPath" parameter, as the
  CometLogger reads the log file generated during the training process.
  
  If you are not able to monitor the live training, you can still log the training
  at the end with :meth:`.log_completed_run`.
  
  Parameters
  ----------
  logdir : str
      Path to the output of the logs
  model : AnnotatorApproach
      Annotator to monitor
  interval : int, optional
      Interval for refreshing, by default 10
docstr_tok: ["Monitors","the","training","of","the","model","and","submits","logs","to","comet",",","given","by","an","interval",".","To","log","a","Spark","NLP","annotator",",","it","will","need","an","``","outputLogPath","''","parameter",",","as","the","CometLogger","reads","the","log","file","generated","during","the","training","process",".","If","you","are","not","able","to","monitor","the","live","training",",","you","can","still","log","the","training","at","the","end","with",":","meth",":","`",".log_completed_run","`",".","Parameters","--","--","--","--","--","logdir",":","str","Path","to","the","output","of","the","logs","model",":","AnnotatorApproach","Annotator","to","monitor","interval",":","int",",","optional","Interval","for","refreshing",",","by","default","10"]
code: def monitor(self, logdir, model, interval=10):
      """Monitors the training of the model and submits logs to comet, given
      by an interval.
  
      To log a Spark NLP annotator, it will need an "outputLogPath" parameter, as the
      CometLogger reads the log file generated during the training process.
  
      If you are not able to monitor the live training, you can still log the training
      at the end with :meth:`.log_completed_run`.
  
      Parameters
      ----------
      logdir : str
          Path to the output of the logs
      model : AnnotatorApproach
          Annotator to monitor
      interval : int, optional
          Interval for refreshing, by default 10
      """
      self._watch_file = True
      self.experiment.log_other("model_uid", model.uid)
      self.thread = threading.Thread(
          target=self._monitor_log_file,
          args=(
              os.path.join(logdir, f"{model.uid}.log"),
              interval,
          ),
      )
      self.thread.start()
  
imports: import threading
  import time
  import os
label_desc: Use image node_id 10 for calling the CometLogger obj's underlying member method code with example usage: obj.monitor(logdir, model, interval) without return types