diff --git a/.pylintrc b/.pylintrc index a8308f4400..056ee6d841 100644 --- a/.pylintrc +++ b/.pylintrc @@ -89,7 +89,6 @@ disable= useless-object-inheritance, # TODO: Remove unnecessary imports cyclic-import, # TODO: Resolve cyclic imports no-self-use, # TODO: Convert methods to functions where appropriate - consider-using-in, # TODO: Consider merging comparisons with "in" too-many-public-methods, # TODO: Resolve consider-using-ternary, # TODO: Consider ternary expressions chained-comparison, # TODO: Simplify chained comparison between operands diff --git a/src/sagemaker/session.py b/src/sagemaker/session.py index b39e0be055..1e904d58d6 100644 --- a/src/sagemaker/session.py +++ b/src/sagemaker/session.py @@ -1022,7 +1022,7 @@ def _check_job_status(self, job, desc, status_key_name): # If the status is capital case, then convert it to Camel case status = _STATUS_CODE_TABLE.get(status, status) - if status != "Completed" and status != "Stopped": + if status not in ("Completed", "Stopped"): reason = desc.get("FailureReason", "(No reason provided)") job_type = status_key_name.replace("JobStatus", " job") 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 client = self.boto_session.client("logs", config=config) log_group = "/aws/sagemaker/TrainingJobs" - job_already_completed = status == "Completed" or status == "Failed" or status == "Stopped" + job_already_completed = status in ("Completed", "Failed", "Stopped") state = LogState.TAILING if wait and not job_already_completed else LogState.COMPLETE dot = False @@ -1385,7 +1385,7 @@ def logs_for_job( # noqa: C901 - suppress complexity warning for this method status = description["TrainingJobStatus"] - if status == "Completed" or status == "Failed" or status == "Stopped": + if status in ("Completed", "Failed", "Stopped"): print() state = LogState.JOB_COMPLETE