code: def post_process_metrics(adapt_iter, workers, metrics):
      # Obtain Current Dataset Metrics and filter out
      name = "_adapt_" + str(adapt_iter) if adapt_iter > 0 else ""
  
      # Only workers are collecting data
      res = collect_metrics(workers=workers)
  
      metrics["episode_reward_max" + str(name)] = res[
          "episode_reward_max"
      ]
      metrics["episode_reward_mean" + str(name)] = res[
          "episode_reward_mean"
      ]
      metrics["episode_reward_min" + str(name)] = res[
          "episode_reward_min"
      ]
  
      return metrics
  
imports: import logging
  from typing import Optional, Type
  import numpy
  from ray.rllib.algorithms.algorithm import Algorithm
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.evaluation.metrics import collect_metrics, get_learner_stats
  from ray.rllib.evaluation.worker_set import WorkerSet
  from ray.rllib.execution.common import STEPS_SAMPLED_COUNTER, STEPS_TRAINED_COUNTER, STEPS_TRAINED_THIS_ITER_COUNTER, _get_shared_metrics
  from ray.rllib.execution.metric_ops import CollectMetrics
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import concat_samples, convert_ma_batch_to_sample_batch
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.deprecation import DEPRECATED_VALUE
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO
  from ray.rllib.utils.sgd import standardized
  from ray.util.iter import LocalIterator, from_actors
label_desc: Use image node_id 2 for calling a global function with example usage: post_process_metrics(adapt_iter, workers, metrics) and returns: metrics