class_docstr: Handles a ListSessionGroups request.
class_docstr_tok: ["Handles","a","ListSessionGroups","request","."]
docstr: Constructs lists of SessionGroups based on DataProvider results.
code: def _session_groups_from_data_provider(self):
      """Constructs lists of SessionGroups based on DataProvider results."""
      filters = _build_data_provider_filters(self._request.col_params)
      sort = _build_data_provider_sort(self._request.col_params)
      hparams_to_include = (
          _get_hparams_to_include(self._request.col_params)
          if _specifies_include(self._request.col_params)
          else None
      )
      response = (
          self._backend_context.session_groups_from_data_provider(
              self._request_context,
              self._experiment_id,
              filters,
              sort,
              hparams_to_include,
          )
      )
  
      metric_infos = (
          self._backend_context.compute_metric_infos_from_data_provider_session_groups(
              self._request_context, self._experiment_id, response
          )
          if self._include_metrics
          else []
      )
  
      all_metric_evals = (
          self._backend_context.read_last_scalars(
              self._request_context,
              self._experiment_id,
              run_tag_filter=None,
          )
          if self._include_metrics
          else {}
      )
  
      session_groups = []
      for provider_group in response:
          sessions = []
          for session in provider_group.sessions:
              session_name = backend_context_lib.generate_data_provider_session_name(
                  session
              )
              sessions.append(
                  self._build_session(
                      metric_infos,
                      session_name,
                      plugin_data_pb2.SessionStartInfo(),
                      plugin_data_pb2.SessionEndInfo(),
                      all_metric_evals,
                  )
              )
  
          name = (
              backend_context_lib.generate_data_provider_session_name(
                  provider_group.root
              )
          )
          if not name:
              name = self._experiment_id
          session_group = api_pb2.SessionGroup(
              name=name,
              sessions=sessions,
          )
  
          for provider_hparam in provider_group.hyperparameter_values:
              hparam = session_group.hparams[
                  provider_hparam.hyperparameter_name
              ]
              if (
                  provider_hparam.domain_type
                  == provider.HyperparameterDomainType.DISCRETE_STRING
              ):
                  hparam.string_value = provider_hparam.value
              elif provider_hparam.domain_type in [
                  provider.HyperparameterDomainType.DISCRETE_FLOAT,
                  provider.HyperparameterDomainType.INTERVAL,
              ]:
                  hparam.number_value = provider_hparam.value
              elif (
                  provider_hparam.domain_type
                  == provider.HyperparameterDomainType.DISCRETE_BOOL
              ):
                  hparam.bool_value = provider_hparam.value
  
          session_groups.append(session_group)
  
      # Compute the session group's aggregated metrics for each group.
      for group in session_groups:
          if group.sessions:
              self._aggregate_metrics(group)
  
      extractors = _create_extractors(self._request.col_params)
      filters = _create_filters(
          self._request.col_params,
          extractors,
          # We assume the DataProvider will apply hparam filters and we do not
          # attempt to reapply them.
          include_hparam_filters=False,
      )
      session_groups = self._filter(session_groups, filters)
      return session_groups
  
imports: import collections
  import dataclasses
  import operator
  import re
  from typing import Optional
  from google.protobuf import struct_pb2
  from tensorboard.data import provider
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import backend_context
  from tensorboard.plugins.hparams import error
  from tensorboard.plugins.hparams import json_format_compat
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import metrics
  from tensorboard.plugins.hparams import plugin_data_pb2
label_desc: Use image node_id 4 for calling the Handler obj's underlying member method code with example usage: obj._session_groups_from_data_provider() and returns: session_groups