class_docstr: Collects samples for all policies and agents from a multi-agent env.
  
  This API is controlled by RolloutWorker objects to store all data
  generated by Environments and Policies/Models during rollout and
  postprocessing. It's purposes are to a) make data collection and
  SampleBatch/input_dict generation from this data faster, b) to unify
  the way we collect samples from environments and model (outputs), thereby
  allowing for possible user customizations, c) to allow for more complex
  inputs fed into different policies (e.g. multi-agent case with inter-agent
  communication channel).
class_docstr_tok: ["Collects","samples","for","all","policies","and","agents","from","a","multi-agent","env",".","This","API","is","controlled","by","RolloutWorker","objects","to","store","all","data","generated","by","Environments","and","Policies\/Models","during","rollout","and","postprocessing",".","It","'s","purposes","are","to","a",")","make","data","collection","and","SampleBatch\/input_dict","generation","from","this","data","faster",",","b",")","to","unify","the","way","we","collect","samples","from","environments","and","model","(","outputs",")",",","thereby","allowing","for","possible","user","customizations",",","c",")","to","allow","for","more","complex","inputs","fed","into","different","policies","(","e.g",".","multi-agent","case","with","inter-agent","communication","channel",")","."]
docstr: Tries to build an MA-batch, if `rollout_fragment_length` is reached.
  
  Any unprocessed data will be first postprocessed with a policy
  postprocessor.
  This is usually called to collect samples for policy training.
  If not enough data has been collected yet (`rollout_fragment_length`),
  returns an empty list.
  
  Returns:
      List[Union[MultiAgentBatch, SampleBatch]]: Returns a (possibly
          empty) list of MultiAgentBatches (containing the accumulated
          SampleBatches for each policy or a simple SampleBatch if only
          one policy). The list will be empty if
          `self.rollout_fragment_length` has not been reached yet.
docstr_tok: ["Tries","to","build","an","MA-batch",",","if","`","rollout_fragment_length","`","is","reached",".","Any","unprocessed","data","will","be","first","postprocessed","with","a","policy","postprocessor",".","This","is","usually","called","to","collect","samples","for","policy","training",".","If","not","enough","data","has","been","collected","yet","(","`","rollout_fragment_length","`",")",",","returns","an","empty","list",".","Returns",":","List","[","Union","[","MultiAgentBatch",",","SampleBatch","]","]",":","Returns","a","(","possibly","empty",")","list","of","MultiAgentBatches","(","containing","the","accumulated","SampleBatches","for","each","policy","or","a","simple","SampleBatch","if","only","one","policy",")",".","The","list","will","be","empty","if","`","self.rollout_fragment_length","`","has","not","been","reached","yet","."]
code: def try_build_truncated_episode_multi_agent_batch(
      self,
  ) -> List[Union[MultiAgentBatch, SampleBatch]]:
      """Tries to build an MA-batch, if `rollout_fragment_length` is reached.
  
      Any unprocessed data will be first postprocessed with a policy
      postprocessor.
      This is usually called to collect samples for policy training.
      If not enough data has been collected yet (`rollout_fragment_length`),
      returns an empty list.
  
      Returns:
          List[Union[MultiAgentBatch, SampleBatch]]: Returns a (possibly
              empty) list of MultiAgentBatches (containing the accumulated
              SampleBatches for each policy or a simple SampleBatch if only
              one policy). The list will be empty if
              `self.rollout_fragment_length` has not been reached yet.
      """
      raise NotImplementedError
  
file_path: ray/rllib/evaluation/collectors/sample_collector.py
imports: import logging
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Dict, List, Optional, Union
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.policy.policy_map import PolicyMap
  from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch
  from ray.rllib.utils.annotations import PublicAPI
  from ray.rllib.utils.typing import AgentID, EnvID, EpisodeID, PolicyID, TensorType
label_desc: Use image node_id 9 for calling the SampleCollector obj's underlying member method code with example usage: obj.try_build_truncated_episode_multi_agent_batch() without return types