CFY-1377 add sleep interval when waiting for processes
CFY-1377 bug fix + flake8