Refactor workflow state polling. Support running nflow-tests using mysql or postgresql profile (where database is not reset on every run)