# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/utils/chunk_execution.ipynb.

# %% auto 0
__all__ = ['run_sequence', 'chunk_list']

# %% ../../nbs/utils/chunk_execution.ipynb 2
from typing import Any, Awaitable

# %% ../../nbs/utils/chunk_execution.ipynb 3
async def run_sequence(*functions: Awaitable[Any] ) -> None:
    """execute a list of functions in a sequence"""

    for function in functions:
        await function

# %% ../../nbs/utils/chunk_execution.ipynb 5
def chunk_list(obj_ls,  # list of entities to split into n chunks
               chunk_size  # entities per sub list
               ) -> list[list[dict]]:  # returns a list of chunk_size lists of objects

    return [obj_ls[i * chunk_size:(i + 1) * chunk_size] for i in range((len(obj_ls) + chunk_size - 1) // chunk_size)]

