The test failed initially due to the timeout issue, so I have included timeout of '600' sec as cpuset machine is very slow. I have attached the logs of the initial run(TestSchedSubjobBadstate.txt)
After fixing the timeout issue, the test was failing while verifiying the log msg "Leaving scheduling cycle" in sched-logs. In sched-logs I could see the msg but it appeared after the test failed.
I removed the paramter "max_attempts" from log_match function so that it takes the default max_attempts(60) and then the tests passed with the changes.
I have attached the logs(TestSchedSubjobBadstate_with_other_fixes) and the updated test script(pbs_sched_subjob_badstate.py)