hunk.code_window:         # Cut the batch if we're not packing multiple episodes into one,
           # or if we've exceeded the requested batch size.
           if episode.batch_builder.has_pending_data():
               if dones[env_id]["__all__"] and not no_done_at_end:
                   episode.batch_builder.check_missing_dones()
               if (all_done and not pack) or \
  
hunk.labels: keep keep keep replace keep keep keep
hunk.after_edit:         if episode.batch_builder.has_pending_agent_data():
  
hunk.file_path: rllib/evaluation/sampler.py
hunk.type: replace
file: import React from "react";
  import { formatByteAmount, formatUsage } from "../../../../common/formatUtils";
  import UsageBar from "../../../../common/UsageBar";
  import {
    ClusterFeatureComponent,
    NodeFeatureComponent,
    WorkerFeatureComponent
  } from "./types";
  
  export const ClusterRAM: ClusterFeatureComponent = ({ nodes }) => {
    let used = 0;
    let total = 0;
    for (const node of nodes) {
      used += node.mem[0] - node.mem[1];
      total += node.mem[0];
    }
    return (
      <UsageBar
        percent={(100 * used) / total}
        text={formatUsage(used, total, "gibibyte")}
      />
    );
  };
  
  export const NodeRAM: NodeFeatureComponent = ({ node }) => (
    <UsageBar
      percent={(100 * (node.mem[0] - node.mem[1])) / node.mem[0]}
      text={formatUsage(node.mem[0] - node.mem[1], node.mem[0], "gibibyte")}
    />
  );
  
  export const WorkerRAM: WorkerFeatureComponent = ({ node, worker }) => (
    <UsageBar
      percent={(100 * worker.memory_info.rss) / node.mem[0]}
      text={formatByteAmount(worker.memory_info.rss, "mebibyte")}
    />
  );
  