framework: each epoch has its own life cycle

Right now we assume the topology doesn't change over epochs. This pull request will work with changing topology.