docstr: Register one or more Dataruns to the Database.
  
  The methods hyperparameters will be analyzed and Hyperpartitions generated
  from them.
  If ``run_per_partition`` is ``True``, one Datarun will be created for each
  Hyperpartition. Otherwise, a single one will be created for all of them.
  
  Args:
      dataset_id (int):
          Id of the Dataset which this Datarun will belong to.
      budget (int):
          Budget amount. Optional. Defaults to ``100``.
      budget_type (str):
          Budget Type. Can be 'classifier' or 'walltime'.
          Optional. Defaults to ``'classifier'``.
      gridding (int):
          ``gridding`` setting for the Tuner. Optional. Defaults to ``0``.
      k_window (int):
          ``k`` setting for the Selector. Optional. Defaults to ``3``.
      metric (str):
          Metric to use for the tuning and selection. Optional. Defaults to ``'f1'``.
      methods (list):
          List of methods to try. Optional. Defaults to ``['logreg', 'dt', 'knn']``.
      r_minimum (int):
          ``r_minimum`` setting for the Tuner. Optional. Defaults to ``2``.
      run_per_partition (bool):
          whether to create a separated Datarun for each Hyperpartition or not.
          Optional. Defaults to ``False``.
      score_target (str):
          Which score to use for the tuning and selection process. It can be ``'cv'`` or
          ``'test'``. Optional. Defaults to ``'cv'``.
      priority (int):
          Priority of this Datarun. The higher the better. Optional. Defaults to ``1``.
      selector (str):
          Type of selector to use. Optional. Defaults to ``'uniform'``.
      tuner (str):
          Type of tuner to use. Optional. Defaults to ``'uniform'``.
      deadline (str):
          Time deadline. It must be a string representing a datetime in the format
          ``'%Y-%m-%d %H:%M'``. If given, ``budget_type`` will be set to ``'walltime'``.
  
  Returns:
      Datarun:
          The created Datarun or list of Dataruns.
docstr_tok: ["Register","one","or","more","Dataruns","to","the","Database",".","The","methods","hyperparameters","will","be","analyzed","and","Hyperpartitions","generated","from","them",".","If","``","run_per_partition","``","is","``","True","``",",","one","Datarun","will","be","created","for","each","Hyperpartition",".","Otherwise",",","a","single","one","will","be","created","for","all","of","them",".","Args",":","dataset_id","(","int",")",":","Id","of","the","Dataset","which","this","Datarun","will","belong","to",".","budget","(","int",")",":","Budget","amount",".","Optional",".","Defaults","to","``","100","``",".","budget_type","(","str",")",":","Budget","Type",".","Can","be","'classifier","'","or","'walltime","'",".","Optional",".","Defaults","to","``","'classifier","'","``",".","gridding","(","int",")",":","``","gridding","``","setting","for","the","Tuner",".","Optional",".","Defaults","to","``","0","``",".","k_window","(","int",")",":","``","k","``","setting","for","the","Selector",".","Optional",".","Defaults","to","``","3","``",".","metric","(","str",")",":","Metric","to","use","for","the","tuning","and","selection",".","Optional",".","Defaults","to","``","'f1","'","``",".","methods","(","list",")",":","List","of","methods","to","try",".","Optional",".","Defaults","to","``","[","'logreg","'",",","'dt","'",",","'knn","'","]","``",".","r_minimum","(","int",")",":","``","r_minimum","``","setting","for","the","Tuner",".","Optional",".","Defaults","to","``","2","``",".","run_per_partition","(","bool",")",":","whether","to","create","a","separated","Datarun","for","each","Hyperpartition","or","not",".","Optional",".","Defaults","to","``","False","``",".","score_target","(","str",")",":","Which","score","to","use","for","the","tuning","and","selection","process",".","It","can","be","``","'cv","'","``","or","``","'test","'","``",".","Optional",".","Defaults","to","``","'cv","'","``",".","priority","(","int",")",":","Priority","of","this","Datarun",".","The","higher","the","better",".","Optional",".","Defaults","to","``","1","``",".","selector","(","str",")",":","Type","of","selector","to","use",".","Optional",".","Defaults","to","``","'uniform","'","``",".","tuner","(","str",")",":","Type","of","tuner","to","use",".","Optional",".","Defaults","to","``","'uniform","'","``",".","deadline","(","str",")",":","Time","deadline",".","It","must","be","a","string","representing","a","datetime","in","the","format","``","'","%","Y-","%","m-","%","d","%","H",":","%","M","'","``",".","If","given",",","``","budget_type","``","will","be","set","to","``","'walltime","'","``",".","Returns",":","Datarun",":","The","created","Datarun","or","list","of","Dataruns","."]
code: def add_datarun(
      self,
      dataset_id,
      budget=100,
      budget_type="classifier",
      gridding=0,
      k_window=3,
      metric="f1",
      methods=["logreg", "dt", "knn"],
      r_minimum=2,
      run_per_partition=False,
      score_target="cv",
      priority=1,
      selector="uniform",
      tuner="uniform",
      deadline=None,
  ):
      """Register one or more Dataruns to the Database.
  
      The methods hyperparameters will be analyzed and Hyperpartitions generated
      from them.
      If ``run_per_partition`` is ``True``, one Datarun will be created for each
      Hyperpartition. Otherwise, a single one will be created for all of them.
  
      Args:
          dataset_id (int):
              Id of the Dataset which this Datarun will belong to.
          budget (int):
              Budget amount. Optional. Defaults to ``100``.
          budget_type (str):
              Budget Type. Can be 'classifier' or 'walltime'.
              Optional. Defaults to ``'classifier'``.
          gridding (int):
              ``gridding`` setting for the Tuner. Optional. Defaults to ``0``.
          k_window (int):
              ``k`` setting for the Selector. Optional. Defaults to ``3``.
          metric (str):
              Metric to use for the tuning and selection. Optional. Defaults to ``'f1'``.
          methods (list):
              List of methods to try. Optional. Defaults to ``['logreg', 'dt', 'knn']``.
          r_minimum (int):
              ``r_minimum`` setting for the Tuner. Optional. Defaults to ``2``.
          run_per_partition (bool):
              whether to create a separated Datarun for each Hyperpartition or not.
              Optional. Defaults to ``False``.
          score_target (str):
              Which score to use for the tuning and selection process. It can be ``'cv'`` or
              ``'test'``. Optional. Defaults to ``'cv'``.
          priority (int):
              Priority of this Datarun. The higher the better. Optional. Defaults to ``1``.
          selector (str):
              Type of selector to use. Optional. Defaults to ``'uniform'``.
          tuner (str):
              Type of tuner to use. Optional. Defaults to ``'uniform'``.
          deadline (str):
              Time deadline. It must be a string representing a datetime in the format
              ``'%Y-%m-%d %H:%M'``. If given, ``budget_type`` will be set to ``'walltime'``.
  
      Returns:
          Datarun:
              The created Datarun or list of Dataruns.
      """
  
      if deadline:
          deadline = datetime.strptime(deadline, TIME_FMT)
          budget_type = "walltime"
  
      elif budget_type == "walltime":
          deadline = datetime.now() + timedelta(minutes=budget)
  
      run_description = "___".join([tuner, selector])
      target = score_target + "_judgment_metric"
  
      method_parts = {}
      for method in methods:
          # enumerate all combinations of categorical variables for this method
          method_instance = Method(method)
          method_parts[method] = method_instance.get_hyperpartitions()
  
          LOGGER.info(
              "method {} has {} hyperpartitions".format(
                  method, len(method_parts[method])
              )
          )
  
      dataruns = list()
      if not run_per_partition:
          datarun = self.db.create_datarun(
              dataset_id=dataset_id,
              description=run_description,
              tuner=tuner,
              selector=selector,
              gridding=gridding,
              priority=priority,
              budget_type=budget_type,
              budget=budget,
              deadline=deadline,
              metric=metric,
              score_target=target,
              k_window=k_window,
              r_minimum=r_minimum,
          )
  
          dataruns.append(datarun)
  
      for method, parts in method_parts.items():
          for part in parts:
              # if necessary, create a new datarun for each hyperpartition.
              # This setting is useful for debugging.
              if run_per_partition:
                  datarun = self.db.create_datarun(
                      dataset_id=dataset_id,
                      description=run_description,
                      tuner=tuner,
                      selector=selector,
                      gridding=gridding,
                      priority=priority,
                      budget_type=budget_type,
                      budget=budget,
                      deadline=deadline,
                      metric=metric,
                      score_target=target,
                      k_window=k_window,
                      r_minimum=r_minimum,
                  )
  
                  dataruns.append(datarun)
  
              # create a new hyperpartition in the database
              self.db.create_hyperpartition(
                  datarun_id=datarun.id,
                  method=method,
                  tunables=part.tunables,
                  constants=part.constants,
                  categoricals=part.categoricals,
                  status=PartitionStatus.INCOMPLETE,
              )
  
      dataset = self.db.get_dataset(dataset_id)
      LOGGER.info("Dataruns created. Summary:")
      LOGGER.info("\tDataset ID: {}".format(dataset.id))
      LOGGER.info("\tTraining data: {}".format(dataset.train_path))
      LOGGER.info("\tTest data: {}".format(dataset.test_path))
  
      if run_per_partition:
          LOGGER.info(
              "\tDatarun IDs: {}".format(
                  ", ".join(str(datarun.id) for datarun in dataruns)
              )
          )
  
      else:
          LOGGER.info("\tDatarun ID: {}".format(dataruns[0].id))
  
      LOGGER.info(
          "\tHyperpartition selection strategy: {}".format(
              dataruns[0].selector
          )
      )
      LOGGER.info(
          "\tParameter tuning strategy: {}".format(dataruns[0].tuner)
      )
      LOGGER.info(
          "\tBudget: {} ({})".format(
              dataruns[0].budget, dataruns[0].budget_type
          )
      )
  
      return dataruns if run_per_partition else dataruns[0]
  
file_path: ATM/atm/core.py
imports: import logging
  import random
  import time
  from datetime import datetime, timedelta
  from operator import attrgetter
  from tqdm import tqdm
  from atm.constants import TIME_FMT, PartitionStatus, RunStatus
  from atm.database import Database
  from atm.method import Method
  from atm.worker import ClassifierError, Worker
label_desc: Use image node_id 3 for calling the ATM obj's underlying member method code with example usage: obj.add_datarun(dataset_id, budget, budget_type, gridding, k_window, metric, methods, r_minimum, run_per_partition, score_target, priority, selector, tuner, deadline) and returns: unknown