grr/server/grr_response_server/client_report_utils.py
def _FetchMostRecentGraphSeriesFromTheLegacyDB(
    label,
    report_type,
    token = None
):
  """Fetches the latest graph-series for a client label from the legacy DB.

  Args:
    label: Client label to fetch data for.
    report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
    token: ACL token to use for reading from the DB.

  Raises:
    AFF4AttributeTypeError: If an unexpected report-data type is encountered.

  Returns:
    The graph series for the given label and report type that was last
    written to the DB, or None if no series for that label and report-type
    exist.
  """
  try:
    stats_for_label = aff4.FACTORY.Open(
        GetAFF4ClientReportsURN().Add(label),
        aff4_type=aff4_stats.ClientFleetStats,
        mode="r",
        token=token)
  except aff4.InstantiationError:
    # Nothing to return for the given label and report-type.
    return None
  aff4_attr = _GetAFF4AttributeForReportType(report_type)
  graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
  if aff4_attr.attribute_type == rdf_stats.GraphSeries:
    graphs = stats_for_label.Get(aff4_attr)
    if graphs is None:
      return None
    for graph in graphs:
      graph_series.graphs.Append(graph)
  elif aff4_attr.attribute_type == rdf_stats.Graph:
    graph = stats_for_label.Get(aff4_attr)
    if graph is None:
      return None
    graph_series.graphs.Append(graph)
  else:
    raise AFF4AttributeTypeError(aff4_attr.attribute_type)
  return graph_series
Fetches the latest graph-series for a client label from the legacy DB.

  Args:
    label: Client label to fetch data for.
    report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
    token: ACL token to use for reading from the DB.

  Raises:
    AFF4AttributeTypeError: If an unexpected report-data type is encountered.

  Returns:
    The graph series for the given label and report type that was last
    written to the DB, or None if no series for that label and report-type
    exist.
  
Fetches the latest graph-series for a client label from the legacy DB.
Fetches the latest graph - series for a client label from the legacy DB .
def _FetchMostRecentGraphSeriesFromTheLegacyDB(
    label,
    report_type,
    token = None
):
  try:
    stats_for_label = aff4.FACTORY.Open(
        GetAFF4ClientReportsURN().Add(label),
        aff4_type=aff4_stats.ClientFleetStats,
        mode="r",
        token=token)
  except aff4.InstantiationError:
    return None
  aff4_attr = _GetAFF4AttributeForReportType(report_type)
  graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
  if aff4_attr.attribute_type == rdf_stats.GraphSeries:
    graphs = stats_for_label.Get(aff4_attr)
    if graphs is None:
      return None
    for graph in graphs:
      graph_series.graphs.Append(graph)
  elif aff4_attr.attribute_type == rdf_stats.Graph:
    graph = stats_for_label.Get(aff4_attr)
    if graph is None:
      return None
    graph_series.graphs.Append(graph)
  else:
    raise AFF4AttributeTypeError(aff4_attr.attribute_type)
  return graph_series
def _FetchMostRecentGraphSeriesFromTheLegacyDB ( label , report_type , token = None ) : try : stats_for_label = aff4 . FACTORY . Open ( GetAFF4ClientReportsURN ( ) . Add ( label ) , aff4_type = aff4_stats . ClientFleetStats , mode = "r" , token = token ) except aff4 . InstantiationError : return None aff4_attr = _GetAFF4AttributeForReportType ( report_type ) graph_series = rdf_stats . ClientGraphSeries ( report_type = report_type ) if aff4_attr . attribute_type == rdf_stats . GraphSeries : graphs = stats_for_label . Get ( aff4_attr ) if graphs is None : return None for graph in graphs : graph_series . graphs . Append ( graph ) elif aff4_attr . attribute_type == rdf_stats . Graph : graph = stats_for_label . Get ( aff4_attr ) if graph is None : return None graph_series . graphs . Append ( graph ) else : raise AFF4AttributeTypeError ( aff4_attr . attribute_type ) return graph_series
Fetches the latest graph-series for a client label from the legacy DB.
Fetches the latest graph - series for a client label from the legacy DB .
"""Fetches the latest graph-series for a client label from the legacy DB.

  Args:
    label: Client label to fetch data for.
    report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
    token: ACL token to use for reading from the DB.

  Raises:
    AFF4AttributeTypeError: If an unexpected report-data type is encountered.

  Returns:
    The graph series for the given label and report type that was last
    written to the DB, or None if no series for that label and report-type
    exist.
  """ # Nothing to return for the given label and report-type.
The graph series for the given label and report type that was last
written to the DB, or None if no series for that label and report-type
exist.
The graph series for the given label and report type that was last written to the DB or None if no series for that label and report - type exist .
If an unexpected report-data type is encountered.
If an unexpected report - data type is encountered .
AFF4AttributeTypeError
label
Client label to fetch data for.
Client label to fetch data for .
report_type
rdf_stats.ClientGraphSeries.ReportType to fetch data for.
rdf_stats . ClientGraphSeries . ReportType to fetch data for .
token
ACL token to use for reading from the DB.
ACL token to use for reading from the DB .