class_docstr: A class representing a Trial object.
  
  A Trial object is usually obtained from :func:`determined.experimental.client.get_trial`.
  Trial reference class used for querying relevant :class:`~determined.experimental.Checkpoint`
  instances.
  
  Attributes:
      trial_id: ID of trial.
      session: HTTP request session.
      experiment_id: (Mutable, Optional[int]) ID of the experiment this trial belongs to.
      hparams: (Mutable, Optional[Dict]) Dict[name, value] of the trial's hyperparameters.
          This is an instance of the hyperparameter space defined by the experiment.
      state: (Mutable, Optional[TrialState]) Trial state (ex: ACTIVE, PAUSED, COMPLETED).
      summary_metrics: (Mutable, Optional[Dict]) Summary metrics for the trial. Includes
          aggregated metrics for training and validation steps for each reported metric name.
          Example:
  
          .. code::
  
              {
                  "avg_metrics": {
                      "loss": {
                          "count": 100,
                          "last": 0.2,
                          "max": 0.4,
                          "min", 0.2,
                          "sum": 1.2,
                          "type": "number",
                      }
              }
  
  Note:
      All attributes are cached by default.
  
      The :attr:`hparams` and :attr:`summary_metrics` attributes are mutable and may be changed
      by methods that update these values, either automatically or explicitly with :meth:`reload`.
class_docstr_tok: ["A","class","representing","a","Trial","object",".","A","Trial","object","is","usually","obtained","from",":","func",":","`","determined.experimental.client.get_trial","`",".","Trial","reference","class","used","for","querying","relevant",":","class",":","`","~determined.experimental.Checkpoint","`","instances",".","Attributes",":","trial_id",":","ID","of","trial",".","session",":","HTTP","request","session",".","experiment_id",":","(","Mutable",",","Optional","[","int","]",")","ID","of","the","experiment","this","trial","belongs","to",".","hparams",":","(","Mutable",",","Optional","[","Dict","]",")","Dict","[","name",",","value","]","of","the","trial","'s","hyperparameters",".","This","is","an","instance","of","the","hyperparameter","space","defined","by","the","experiment",".","state",":","(","Mutable",",","Optional","[","TrialState","]",")","Trial","state","(","ex",":","ACTIVE",",","PAUSED",",","COMPLETED",")",".","summary_metrics",":","(","Mutable",",","Optional","[","Dict","]",")","Summary","metrics","for","the","trial",".","Includes","aggregated","metrics","for","training","and","validation","steps","for","each","reported","metric","name",".","Example",":","..","code",":",":","{","``","avg_metrics","''",":","{","``","loss","''",":","{","``","count","''",":","100",",","``","last","''",":","0.2",",","``","max","''",":","0.4",",","``","min","''",",","0.2",",","``","sum","''",":","1.2",",","``","type","''",":","``","number","''",",","}","}","Note",":","All","attributes","are","cached","by","default",".","The",":","attr",":","`","hparams","`","and",":","attr",":","`","summary_metrics","`","attributes","are","mutable","and","may","be","changed","by","methods","that","update","these","values",",","either","automatically","or","explicitly","with",":","meth",":","`","reload","`","."]
docstr: Return an iterable of log lines from this trial meeting the specified criteria.
  
  Arguments:
      follow (bool, optional): If the iterable should block waiting for new logs to arrive.
          Mutually exclusive with ``head`` and ``tail``.  Defaults to ``False``.
      head (int, optional): When set, only fetches the first ``head`` lines.  Mutually
          exclusive with ``follow`` and ``tail``.  Defaults to ``None``.
      tail (int, optional): When set, only fetches the first ``head`` lines.  Mutually
          exclusive with ``follow`` and ``head``.  Defaults to ``None``.
      container_ids (List[str], optional): When set, only fetch logs from lines from
          specific containers.  Defaults to ``None``.
      rank_ids (List[int], optional): When set, only fetch logs from lines from
          specific ranks.  Defaults to ``None``.
      stdtypes (List[int], optional): When set, only fetch logs from lines from the given
          stdio outputs.  Defaults to ``None`` (same as ``["stdout", "stderr"]``).
      min_level (LogLevel, optional): When set, defines the minimum log priority for lines
          that will be returned.  Defaults to ``None`` (all logs returned).
      timestamp_before (Union[str, int], optional): Specifies a timestamp that returns only
          logs before a certain time. Accepts either a string in RFC 3339 format
          (eg. ``2021-10-26T23:17:12Z``) or an int representing the epoch second.
      timestamp_after (Union[str, int], optional): Specifies a timestamp that returns only
          logs after a certain time. Accepts either a string in RFC 3339 format
          (eg. ``2021-10-26T23:17:12Z``) or an int representing the epoch second.
      sources (List[str], optional): When set, returns only logs originating from specified
          node name(s) (eg. ``master`` or ``agent``).
      search_text (str, Optional): Filters individual logs to only return logs containing
          the specified string.
code: def iter_logs(
      self,
      follow: bool = False,
      *,
      head: Optional[int] = None,
      tail: Optional[int] = None,
      container_ids: Optional[List[str]] = None,
      rank_ids: Optional[List[int]] = None,
      stdtypes: Optional[List[str]] = None,
      min_level: Optional[LogLevel] = None,
      timestamp_before: Optional[Union[str, int]] = None,
      timestamp_after: Optional[Union[str, int]] = None,
      sources: Optional[List[str]] = None,
      search_text: Optional[str] = None,
  ) -> Iterable[str]:
      """
      Return an iterable of log lines from this trial meeting the specified criteria.
  
      Arguments:
          follow (bool, optional): If the iterable should block waiting for new logs to arrive.
              Mutually exclusive with ``head`` and ``tail``.  Defaults to ``False``.
          head (int, optional): When set, only fetches the first ``head`` lines.  Mutually
              exclusive with ``follow`` and ``tail``.  Defaults to ``None``.
          tail (int, optional): When set, only fetches the first ``head`` lines.  Mutually
              exclusive with ``follow`` and ``head``.  Defaults to ``None``.
          container_ids (List[str], optional): When set, only fetch logs from lines from
              specific containers.  Defaults to ``None``.
          rank_ids (List[int], optional): When set, only fetch logs from lines from
              specific ranks.  Defaults to ``None``.
          stdtypes (List[int], optional): When set, only fetch logs from lines from the given
              stdio outputs.  Defaults to ``None`` (same as ``["stdout", "stderr"]``).
          min_level (LogLevel, optional): When set, defines the minimum log priority for lines
              that will be returned.  Defaults to ``None`` (all logs returned).
          timestamp_before (Union[str, int], optional): Specifies a timestamp that returns only
              logs before a certain time. Accepts either a string in RFC 3339 format
              (eg. ``2021-10-26T23:17:12Z``) or an int representing the epoch second.
          timestamp_after (Union[str, int], optional): Specifies a timestamp that returns only
              logs after a certain time. Accepts either a string in RFC 3339 format
              (eg. ``2021-10-26T23:17:12Z``) or an int representing the epoch second.
          sources (List[str], optional): When set, returns only logs originating from specified
              node name(s) (eg. ``master`` or ``agent``).
          search_text (str, Optional): Filters individual logs to only return logs containing
              the specified string.
  
      """
      if head is not None and head < 0:
          raise ValueError(f"head must be non-negative, got {head}")
      if tail is not None and tail < 0:
          raise ValueError(f"tail must be non-negative, got {tail}")
  
      if (
          timestamp_before is not None
          and not isinstance(timestamp_before, (str, int))
          or timestamp_after is not None
          and not isinstance(timestamp_after, (str, int))
      ):
          raise ValueError(
              "timestamp_before and timestamp_after must be either str or int types."
          )
  
      # Validate and convert epoch timestamps to RFC 3339-formatted datetime strings.
      if isinstance(
          timestamp_before, str
      ) and not util.is_protobuf_timestamp(timestamp_before):
          raise ValueError(
              f"Timestamp {timestamp_before} has an invalid format."
          )
      if isinstance(
          timestamp_after, str
      ) and not util.is_protobuf_timestamp(timestamp_after):
          raise ValueError(
              f"Timestamp {timestamp_after} has an invalid format."
          )
  
      if isinstance(timestamp_before, int):
          datetime_before = datetime.datetime.fromtimestamp(
              timestamp_before
          )
          timestamp_before = datetime_before.isoformat("T") + "Z"
      if isinstance(timestamp_after, int):
          datetime_after = datetime.datetime.fromtimestamp(
              timestamp_after
          )
          timestamp_after = datetime_after.isoformat("T") + "Z"
  
      for log in logs.trial_logs(
          session=self._session,
          trial_id=self.id,
          head=head,
          tail=tail,
          follow=follow,
          # TODO: Rename this to "node_id" and support it in the python sdk.
          agent_ids=None,
          container_ids=container_ids,
          rank_ids=rank_ids,
          sources=sources,
          stdtypes=stdtypes,
          min_level=None
          if min_level is None
          else min_level._to_bindings(),
          timestamp_before=timestamp_before,
          timestamp_after=timestamp_after,
          search_text=search_text,
      ):
          yield log.message
  
imports: import datetime
  import enum
  import inspect
  import warnings
  from typing import Any, Dict, Iterable, List, Optional, Union
  from determined.common import api, util
  from determined.common.api import bindings, logs
  from determined.common.experimental import checkpoint, metrics
  from determined.common.experimental._util import OrderBy
label_desc: Use image node_id 2 for calling the Trial obj's underlying member method code with example usage: obj.iter_logs(follow) without return types