async def run_node(menv, log_folder):
    """Run :class:`~creamas.mp.MultiEnvironment` until its manager's
    :meth:`~aiomas.subproc.Manager.stop` is called.

    :param menv: :class:`~creamas.mp.MultiEnvironment` to wait for.
    :param str log_folder:
        Logging folder to be passed down to
        :meth:`~creamas.mp.MultiEnvironment.destroy` after :meth:`stop` is
        called.

    This method will block the current thread until the manager's
    :meth:`~creamas.mp.MultiEnvManager.stop` is called. After the stop-message
    is received, multi-environment is destroyed.

    The method is intended to be
    used in :class:`~creamas.ds.DistributedEnvironment` scripts which spawn
    multi-environments on different nodes. That is, using this function in the
    script will block the script's further execution until the simulation has
    run its course and the nodes need to be destroyed.
    Calling :meth:`~creamas.ds.DistributedEnvironment.destroy` will
    automatically call each node manager's :meth:`stop` and therefore release
    the script.
    """
    try:
        await menv.manager.stop_received
    except KeyboardInterrupt:
        pass
    finally:
        ret = await menv.destroy(log_folder, as_coro=True)
        return ret
Run :class:`~creamas.mp.MultiEnvironment` until its manager's
    :meth:`~aiomas.subproc.Manager.stop` is called.

    :param menv: :class:`~creamas.mp.MultiEnvironment` to wait for.
    :param str log_folder:
        Logging folder to be passed down to
        :meth:`~creamas.mp.MultiEnvironment.destroy` after :meth:`stop` is
        called.

    This method will block the current thread until the manager's
    :meth:`~creamas.mp.MultiEnvManager.stop` is called. After the stop-message
    is received, multi-environment is destroyed.

    The method is intended to be
    used in :class:`~creamas.ds.DistributedEnvironment` scripts which spawn
    multi-environments on different nodes. That is, using this function in the
    script will block the script's further execution until the simulation has
    run its course and the nodes need to be destroyed.
    Calling :meth:`~creamas.ds.DistributedEnvironment.destroy` will
    automatically call each node manager's :meth:`stop` and therefore release
    the script.