class_docstr: Store that represents persistent state for experiments.
  
  Apart from initialization, the user should not be using its methods normally.
class_docstr_tok: ["Store","that","represents","persistent","state","for","experiments",".","Apart","from","initialization",",","the","user","should","not","be","using","its","methods","normally","."]
code: def measure_from_db_task(self, task_orm):
      from powerlift.bench.experiment import Measure
      from collections import defaultdict
  
      measure_outcomes_orm = task_orm.measure_outcomes
      desc_id_to_measure_description_orm = {}
      desc_id_to_values = defaultdict(list)
      desc_name_to_measure = {}
  
      for measure_outcome_orm in measure_outcomes_orm:
          desc_id = measure_outcome_orm.measure_description_id
          if desc_id not in desc_id_to_measure_description_orm:
              measure_description_orm = (
                  measure_outcome_orm.measure_description
              )
              desc_id_to_measure_description_orm[
                  desc_id
              ] = measure_description_orm
          measure_description_orm = desc_id_to_measure_description_orm[
              desc_id
          ]
          _type = measure_description_orm.type
          if _type == db.TypeEnum.NUMBER:
              val = measure_outcome_orm.num_val
          elif _type == db.TypeEnum.STR:
              val = measure_outcome_orm.str_val
          elif _type == db.TypeEnum.JSON:
              val = measure_outcome_orm.json_val
          else:
              raise RuntimeError("Code branch should be unreachable")
  
          desc_id_to_values[desc_id].append(
              {
                  "seq_num": measure_outcome_orm.seq_num,
                  "timestamp": measure_outcome_orm.timestamp,
                  "val": val,
              }
          )
  
      for desc_id in desc_id_to_values.keys():
          values_df = pd.DataFrame.from_records(
              desc_id_to_values[desc_id], index="seq_num"
          )
          measure_description_orm = desc_id_to_measure_description_orm[
              desc_id
          ]
          measure = Measure(
              measure_description_orm.name,
              measure_description_orm.description,
              measure_description_orm.type,
              measure_description_orm.lower_is_better,
              values_df,
          )
          desc_name_to_measure[measure.name] = measure
      return desc_name_to_measure
  
imports: import pytz
  import base64
  from dataclasses import dataclass
  from typing import Any, Dict, Generator, Iterable, List, Optional, Tuple, Type
  import random
  import random
  from powerlift.db.actions import delete_db, create_db
  from powerlift.measures import class_stats, data_stats, regression_stats
  from sqlalchemy.exc import IntegrityError
  from sqlalchemy import create_engine
  from tqdm import tqdm
  from itertools import chain
  from sqlalchemy.orm import Session
  import io
  import os
  from powerlift.db import schema
  import numbers
  from datetime import datetime
  import pathlib
  import pandas
  import ast
label_desc: Use image node_id 7 for calling the Store obj's underlying member method code with example usage: obj.measure_from_db_task(task_orm) and returns: desc_name_to_measure