@@ -1022,7 +1022,7 @@ def _check_job_status(self, job, desc, status_key_name):
1022
1022
# If the status is capital case, then convert it to Camel case
1023
1023
status = _STATUS_CODE_TABLE .get (status , status )
1024
1024
1025
- if status != "Completed" and status != "Stopped" :
1025
+ if status not in ( "Completed" , "Stopped" ) :
1026
1026
reason = desc .get ("FailureReason" , "(No reason provided)" )
1027
1027
job_type = status_key_name .replace ("JobStatus" , " job" )
1028
1028
raise ValueError ("Error for {} {}: {} Reason: {}" .format (job_type , job , status , reason ))
@@ -1292,7 +1292,7 @@ def logs_for_job( # noqa: C901 - suppress complexity warning for this method
1292
1292
client = self .boto_session .client ("logs" , config = config )
1293
1293
log_group = "/aws/sagemaker/TrainingJobs"
1294
1294
1295
- job_already_completed = status == "Completed" or status == "Failed" or status == "Stopped"
1295
+ job_already_completed = status in ( "Completed" , "Failed" , "Stopped" )
1296
1296
1297
1297
state = LogState .TAILING if wait and not job_already_completed else LogState .COMPLETE
1298
1298
dot = False
@@ -1385,7 +1385,7 @@ def logs_for_job( # noqa: C901 - suppress complexity warning for this method
1385
1385
1386
1386
status = description ["TrainingJobStatus" ]
1387
1387
1388
- if status == "Completed" or status == "Failed" or status == "Stopped" :
1388
+ if status in ( "Completed" , "Failed" , "Stopped" ) :
1389
1389
print ()
1390
1390
state = LogState .JOB_COMPLETE
1391
1391
0 commit comments