code: def test_bulk_sampler_remainder(scratch_dir):
      el = (
          karate.get_edgelist()
          .reset_index()
          .rename(columns={"index": "eid"})
      )
      el["eid"] = el["eid"].astype("int32")
      el["etp"] = cupy.int32(0)
  
      G = cugraph.Graph(directed=True)
      G.from_cudf_edgelist(
          el,
          source="src",
          destination="dst",
          edge_attr=["wgt", "eid", "etp"],
      )
  
      samples_path = os.path.join(
          scratch_dir, "test_bulk_sampler_remainder"
      )
      create_directory_with_overwrite(samples_path)
  
      bs = BulkSampler(
          batch_size=2,
          output_path=samples_path,
          graph=G,
          seeds_per_call=7,
          batches_per_partition=2,
          fanout_vals=[2, 2],
          with_replacement=False,
      )
  
      # Should process batch (0, 1, 2) then (3, 4, 5) then 6
  
      batches = cudf.DataFrame(
          {
              "start": cudf.Series(
                  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
                  dtype="int32",
              ),
              "batch": cudf.Series(
                  [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6],
                  dtype="int32",
              ),
          }
      )
  
      bs.add_batches(
          batches, start_col_name="start", batch_col_name="batch"
      )
      bs.flush()
  
      recovered_samples = cudf.read_parquet(samples_path)
      assert "map" not in recovered_samples.columns
  
      for b in batches["batch"].unique().values_host.tolist():
          assert b in recovered_samples["batch_id"].values_host.tolist()
  
      for x in range(0, 6, 2):
          subdir = f"{x}-{x+1}"
          df = cudf.read_parquet(
              os.path.join(samples_path, f"batch={subdir}.parquet")
          )
  
          assert ((df.batch_id == x) | (df.batch_id == (x + 1))).all()
          assert ((df.hop_id == 0) | (df.hop_id == 1)).all()
  
      assert (
          cudf.read_parquet(
              os.path.join(samples_path, "batch=6-6.parquet")
          ).batch_id
          == 6
      ).all()
  
      shutil.rmtree(samples_path)
  
file_path: cugraph/python/cugraph/cugraph/tests/sampling/test_bulk_sampler.py
imports: import pytest
  import cudf
  import cupy
  import cugraph
  from cugraph.datasets import karate, email_Eu_core
  from cugraph.gnn import BulkSampler
  from cugraph.utilities.utils import create_directory_with_overwrite
  import os
  import shutil
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: test_bulk_sampler_remainder(scratch_dir) without return types