class_docstr: Experiment Class - create and run an experiment
  
  :param exp_config: configuration of the experiment
  :type exp_config: BasicConfig.BasicConfig
  :param username: username, default: None - will use login username
  :type username: str
  :param connector: connector to database
  :type connector: AbstractConnector
  :param auppath: Auptimizer env.ini file folder, default is either ``./.aup`` or ``~/.aup``
  :type auppath: str
  :param sleep_time: time to pause between jobs
  :type sleep_time: int
class_docstr_tok: ["Experiment","Class","-","create","and","run","an","experiment",":","param","exp_config",":","configuration","of","the","experiment",":","type","exp_config",":","BasicConfig.BasicConfig",":","param","username",":","username",",","default",":","None","-","will","use","login","username",":","type","username",":","str",":","param","connector",":","connector","to","database",":","type","connector",":","AbstractConnector",":","param","auppath",":","Auptimizer","env.ini","file","folder",",","default","is","either","``",".\/.aup","``","or","``","~\/.aup","``",":","type","auppath",":","str",":","param","sleep_time",":","time","to","pause","between","jobs",":","type","sleep_time",":","int"]
code: def __init__(
      self,
      exp_config,
      username=None,
      connector=None,
      auppath=os.path.join(".aup"),
      sleep_time=1,
      eid=None,
      start=True,
      request_stop_time=5,
  ):
      self.sleep_time = sleep_time
      self.fail_safe = False
      self.job_retries = 0
      self.exp_config = _verify_config(exp_config)
      self.resource_args = None
      self.connector = (
          connector
          if connector
          else get_default_connector(auppath=auppath, log=logger)
      )
      self.username = get_default_username(username)
      self.is_compression_exp = False
      self.compression_params = []
      self.request_stop_thr = None
      self.request_stop_time = request_stop_time
      self.submitted = False
  
      if "job_failure" in self.exp_config:
          set_default_keyvalue(
              "ignore_fail",
              False,
              self.exp_config["job_failure"],
              log=logger,
          )
          set_default_keyvalue(
              "job_retries",
              3,
              self.exp_config["job_failure"],
              log=logger,
          )
          self.fail_safe = self.exp_config["job_failure"]["ignore_fail"]
          self.job_retries = self.exp_config["job_failure"][
              "job_retries"
          ]
  
      if "compression" in self.exp_config:
          self.is_compression_exp = True
          (
              self.exp_config,
              self.compression_params,
          ) = translate_compression_config(self.exp_config)
  
      set_default_keyvalue(
          "cwd", os.getcwd(), self.exp_config, log=logger
      )
      set_default_keyvalue(
          "workingdir", os.getcwd(), self.exp_config, log=logger
      )
      set_default_keyvalue("n_parallel", 1, self.exp_config, log=logger)
      check_missing_key(
          self.exp_config,
          "target",
          "Specify max/min for target",
          log=logger,
      )
      check_missing_key(
          self.exp_config,
          "proposer",
          "Specify the optimization `proposer`",
          log=logger,
      )
      self.proposer = get_proposer(self.exp_config["proposer"])(
          self.exp_config
      )
      if "resource_args" in self.exp_config:
          if "early_stop" in self.exp_config["resource_args"]:
              self.exp_config["resource_args"][
                  "track_intermediate_results"
              ] = True
          self.resource_manager = get_resource_manager(
              self.exp_config["resource"],
              self.connector,
              self.exp_config["n_parallel"],
              auppath=auppath,
              maximize=(self.exp_config["target"] == "max"),
              **self.exp_config["resource_args"],
              workingdir=self.exp_config["workingdir"],
              script=self.exp_config["script"],
              runtime_args=exp_config.get("runtime_args", {}),
          )
          self.resource_args = self.exp_config["resource_args"]
      else:
          self.resource_manager = get_resource_manager(
              self.exp_config["resource"],
              self.connector,
              self.exp_config["n_parallel"],
              auppath=auppath,
              maximize=(self.exp_config["target"] == "max"),
              workingdir=self.exp_config["workingdir"],
              script=self.exp_config["script"],
              runtime_args=exp_config.get("runtime_args", {}),
          )
      if eid is None:
          if start is True:
              self.eid = (
                  self.resource_manager.connector.start_experiment(
                      self.username,
                      self.exp_config["name"],
                      json.dumps(self.exp_config),
                  )
              )
          else:
              self.eid = (
                  self.resource_manager.connector.create_experiment(
                      self.username,
                      self.exp_config["name"],
                      json.dumps(self.exp_config),
                  )
              )
      else:
          self.eid = eid
          self.resource_manager.connector.start_experiment_by_eid(
              self.eid
          )
      self.resource_manager.eid = self.eid
      self.pending_jobs = {}
      if "runtime_args" in exp_config:
          self.runtime_args = exp_config["runtime_args"]
      else:
          self.runtime_args = {}
      logger.info("Experiment %d is created" % self.eid)
      logger.debug(
          "Experiment config is %s" % json.dumps(self.exp_config)
      )
  
imports: import json
  import logging
  import os
  import signal
  import sys
  import _thread
  import threading
  import time
  from ..Proposer import get_proposer, SPECIAL_EXIT_PROPOSERS
  from .Job import Job
  from .Resource import get_resource_manager
  from ..aup import BasicConfig
  from ..utils import set_default_keyvalue, check_missing_key, get_default_connector, get_default_username
  from ..compression.utils import *
  from ..Proposer import ProposerStatus
label_desc: Use image node_id 1 to create a new Experiment object  with example: obj = Experiment(exp_config, username, connector, auppath, sleep_time, eid, start, request_stop_time)