class_docstr: The Client-side methods corresponding to the ray API. Delegates
  to the Client Worker that contains the connection to the ClientServer.
class_docstr_tok: ["The","Client-side","methods","corresponding","to","the","ray","API",".","Delegates","to","the","Client","Worker","that","contains","the","connection","to","the","ClientServer","."]
code: def timeline(
      self, filename: Optional[str] = None
  ) -> Optional[List[Any]]:
      logger.warning(
          "Timeline will include events from other clients using this server."
      )
      # This should be imported here, otherwise, it will error doc build.
      import ray.core.generated.ray_client_pb2 as ray_client_pb2
  
      all_events = self.worker.get_cluster_info(
          ray_client_pb2.ClusterInfoType.TIMELINE
      )
      if filename is not None:
          with open(filename, "w") as outfile:
              json.dump(all_events, outfile)
      else:
          return all_events
  
imports: import json
  import logging
  from concurrent.futures import Future
  from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
  from ray._private import ray_option_utils
  from ray.util.client.runtime_context import _ClientWorkerPropertyAPI
label_desc: Use image node_id 21 for calling the _ClientAPI obj's underlying member method code with example usage: obj.timeline(filename) and returns: all_events