    def split_job(
        self, job: Job[T_IN, T_OUT], split_indexes: list[int]
    ) -> tuple[Job[T_IN, T_OUT], Job[T_IN, T_OUT]]:
        """Split the job into two child jobs and process them separately."""
        from ..runner.container import AutoContainer

        logger.debug(
            "Splitting batch into two child batches with indexes: %s", split_indexes
        )
        split_batches = AutoContainer.batch_to_batches(
            job.data, split_indexes, self.batch_dim[0]
        )
        assert len(split_batches) == 2
        first_child = attr.evolve(
            job, data=split_batches[0], future=self._loop.create_future()
        )
        second_child = attr.evolve(
            job, data=split_batches[1], future=self._loop.create_future()
        )

        def child_done_callback(fut: asyncio.Future[T_OUT | Exception]):
            if fut.cancelled():
                job.future.cancel()
                return
            if job.future.done():
                return
            result = fut.result()
            if isinstance(result, Exception):
                job.future.set_result(result)
                return
            if first_child.future.done() and second_child.future.done():
                result, _ = AutoContainer.batches_to_batch(
                    [first_child.future.result(), second_child.future.result()],
                    self.batch_dim[1],
                )
                job.future.set_result(result)

        first_child.future.add_done_callback(child_done_callback)
        second_child.future.add_done_callback(child_done_callback)
        return first_child, second_child
Split the job into two child jobs and process them separately.
src/bentoml/_internal/marshal/dispatcher.py