def _begin_validation(
        session: UpdateSession,
        loop: asyncio.AbstractEventLoop,
        downloaded_update_path: str,
        robot_name: str) -> asyncio.futures.Future:
    """ Start the validation process. """
    session.set_stage(Stages.VALIDATING)

    validation_future \
        = asyncio.ensure_future(loop.run_in_executor(
            None, validate_update,
            downloaded_update_path, session.set_progress))

    def validation_done(fut):
        exc = fut.exception()
        if exc:
            session.set_error(getattr(exc, 'short', str(type(exc))),
                              str(exc))
        else:
            rootfs_file, bootfs_file = fut.result()
            loop.call_soon_threadsafe(_begin_write,
                                      session,
                                      loop,
                                      rootfs_file,
                                      robot_name)
    validation_future.add_done_callback(validation_done)
    return validation_future
def _begin_validation ( session : UpdateSession , loop : asyncio . AbstractEventLoop , downloaded_update_path : str , robot_name : str ) -> asyncio . futures . Future : session . set_stage ( Stages . VALIDATING ) validation_future = asyncio . ensure_future ( loop . run_in_executor ( None , validate_update , downloaded_update_path , session . set_progress ) ) def validation_done ( fut ) : exc = fut . exception ( ) if exc : session . set_error ( getattr ( exc , 'short' , str ( type ( exc ) ) ) , str ( exc ) ) else : rootfs_file , bootfs_file = fut . result ( ) loop . call_soon_threadsafe ( _begin_write , session , loop , rootfs_file , robot_name ) validation_future . add_done_callback ( validation_done ) return validation_future
Start the validation process.