class_docstr: Data provider for managing experiment lifecycle.
class_docstr_tok: ["Data","provider","for","managing","experiment","lifecycle","."]
code: def add_experiment(
      self, experiment: Experiment, userid=None, compression=None
  ):
      self._delete(self._get_experiments_keybase() + experiment.key)
      experiment.time_added = time.time()
      experiment.status = "waiting"
  
      compression = compression if compression else self.compression
  
      for tag, item in experiment.artifacts.items():
          art: Artifact = item
          if art.is_mutable:
              art.key = self._get_mutable_artifact_key(experiment, tag)
          else:
              if art.local_path is not None:
                  # upload immutable artifacts
                  art.key = art.upload(art.local_path)
              elif art.hash is not None:
                  art.key = self._get_immutable_artifact_key(
                      art.hash, compression=compression
                  )
  
          if art.key is not None and art.remote_path is None:
              art.remote_path = (
                  art.storage_handler.get_qualified_location(art.key)
              )
  
      userid = userid if userid else self._get_userid()
      experiment.owner = userid
  
      experiment_dict = experiment.to_dict()
  
      self._set(
          self._get_experiments_keybase() + experiment.key,
          experiment_dict,
      )
  
      if not experiment.from_compl_service:
          self._set(
              self._get_user_keybase(userid)
              + "experiments/"
              + experiment.key,
              experiment.time_added,
          )
  
          if experiment.project and userid:
              self._set(
                  self._get_projects_keybase()
                  + experiment.project
                  + "/"
                  + experiment.key
                  + "/owner",
                  userid,
              )
  
      retry(
          lambda: self.checkpoint_experiment(experiment),
          sleep_time=10,
          logger=self.logger,
      )
      self.logger.info("Added experiment %s", experiment.key)
  
imports: import time
  from concurrent.futures import ThreadPoolExecutor, wait
  from studio.util import util, logs
  from studio.storage.storage_handler import StorageHandler
  from studio.artifacts.artifact import Artifact
  from studio.experiments.experiment import Experiment, experiment_from_dict
  from studio.storage.storage_setup import get_storage_verbose_level
  from studio.util.util import retry, report_fatal, compression_to_extension, check_for_kb_interrupt
label_desc: Use image node_id 9 for calling the KeyValueProvider obj's underlying member method code with example usage: obj.add_experiment(experiment, userid, compression) without return types