Instead of this line, while job_status in ('InProgress') and job_sec_status in ('FeatureEngineering'), it will be while job_status in 'InProgress' and job_sec_status in 'FeatureEngineering' Same goes for Model Tuning, while job_status in 'InProgress' and job_sec_status in 'ModelTuning'