Use a state_dir to allow resume.