def is_already_processed(
    output_root: str,
    args_str: str,
    object_names: list[str],
) -> bool:
    """Determines whether a group of text files has already been processed.

    Checks the done fie at output root to determine this.

    Args:
        output_root (str): Output folder where a done file may exist
        args_str (str): String representation of the arguments
        object_names (List[str]): Names of objects to convert to MDS format
    """
    log.info(
        f'Checking if {len(object_names)} objects have already been processed in {output_root}',
    )

    # Retrieve the done file contents
    output_object_store = maybe_create_object_store_from_uri(output_root)
    if output_object_store is not None:
        # Download and read the done file from the remote object store
        _, _, output_folder_prefix = parse_uri(output_root)
        try:
            with tempfile.TemporaryDirectory() as tmp_dir:
                done_file = os.path.join(tmp_dir, DONE_FILENAME)
                download_file(
                    object_store=output_object_store,
                    object_name=os.path.join(
                        output_folder_prefix,
                        DONE_FILENAME,
                    ),
                    output_filename=done_file,
                )
                with open(done_file) as df:
                    done_file_contents = df.read().splitlines()
                log.info(f'Retrieved done file contents from remote storage')
        except FileNotFoundError:
            log.info('Done file not found in remote storage')
            return False
    else:
        # Read the local done file
        done_file = os.path.join(output_root, DONE_FILENAME)
        if not os.path.isfile(done_file):
            log.info('Done file not found in local storage')
            return False
        with open(done_file) as df:
            done_file_contents = df.read().splitlines()
        log.info(f'Retrieved done file contents from local storage')

    # Compare the arguments
    prev_args_str = done_file_contents[0]
    if prev_args_str != args_str:
        log.info('Arguments have changed, reprocessing required')
        return False

    # Compare file names
    prev_names = done_file_contents[1:]
    if len(prev_names) != len(object_names):
        log.info('Number of files has changed, reprocessing required')
        return False
    for idx, prev_name in enumerate(prev_names):
        if object_names[idx] != prev_name:
            log.info('File names have changed, reprocessing required')
            return False

    log.info('All files have already been processed')
    return True
Determines whether a group of text files has already been processed.

    Checks the done fie at output root to determine this.

    Args:
        output_root (str): Output folder where a done file may exist
        args_str (str): String representation of the arguments
        object_names (List[str]): Names of objects to convert to MDS format
    
llmfoundry/command_utils/data_prep/convert_text_to_mds.py