def _batch_job_generator(ts, query, indices, batch_size):
    """
    A generator that yields the iteration, batch_size, subsequence
    and query for both single and multi processing.

    Parameters
    ----------
    ts : np.array
        The time series to compute similarity distances for.
    query : np.array
        The query to find matches for within the time series.
    indices : list(int)
        Indices to generate tasks for. It is primarily used for subsequence
        partitioning.
    batch_size : int
        The subsequence size.

    Returns
    -------
    A yielded job to compute.
    """
    for iteration, i in enumerate(indices):
        subsequence = ts[i:i + batch_size]
        yield iteration, batch_size, subsequence, query
