Skip to content

Commit 41ffaa5

Browse files
authored
change: enable logging-not-lazy pylint check (#909)
1 parent a6585e2 commit 41ffaa5

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

.pylintrc

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ disable=
8484
line-too-long, # We let Flake8 take care of this # TODO: Fix these and stop relying on flake8
8585
len-as-condition, # TODO: Enable this check once pylint 2.4.0 is released and consumed due to the fix in https://github.com/PyCQA/pylint/issues/2684
8686
import-error, # TODO: Fix import errors
87-
logging-not-lazy, # TODO: Fix logging
8887
attribute-defined-outside-init, # TODO: Fix scope
8988
protected-access, # TODO: Fix access
9089
abstract-method, # TODO: Fix abstract methods

src/sagemaker/analytics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ def training_job_summaries(self, force_refresh=False):
186186
output = []
187187
next_args = {}
188188
for count in range(100):
189-
logging.debug("Calling list_training_jobs_for_hyper_parameter_tuning_job %d" % count)
189+
logging.debug("Calling list_training_jobs_for_hyper_parameter_tuning_job %d", count)
190190
raw_result = self._sage_client.list_training_jobs_for_hyper_parameter_tuning_job(
191191
HyperParameterTuningJobName=self.name, MaxResults=100, **next_args
192192
)
193193
new_output = raw_result["TrainingJobSummaries"]
194194
output.extend(new_output)
195195
logging.debug(
196-
"Got %d more TrainingJobs. Total so far: %d" % (len(new_output), len(output))
196+
"Got %d more TrainingJobs. Total so far: %d", len(new_output), len(output)
197197
)
198198
if ("NextToken" in raw_result) and (len(new_output) > 0):
199199
next_args["NextToken"] = raw_result["NextToken"]
@@ -296,7 +296,7 @@ def _fetch_metric(self, metric_name):
296296
}
297297
raw_cwm_data = self._cloudwatch.get_metric_statistics(**request)["Datapoints"]
298298
if len(raw_cwm_data) == 0:
299-
logging.warning("Warning: No metrics called %s found" % metric_name)
299+
logging.warning("Warning: No metrics called %s found", metric_name)
300300
return
301301

302302
# Process data: normalize to starting time, and sort.

src/sagemaker/local/entities.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ def _wait_for_serving_container(serving_port):
427427
if i >= HEALTH_CHECK_TIMEOUT_LIMIT:
428428
raise RuntimeError("Giving up, endpoint didn't launch correctly")
429429

430-
logger.info("Checking if serving container is up, attempt: %s" % i)
430+
logger.info("Checking if serving container is up, attempt: %s", i)
431431
_, code = _perform_request(endpoint_url, http)
432432
if code != 200:
433-
logger.info("Container still not up, got: %s" % code)
433+
logger.info("Container still not up, got: %s", code)
434434
else:
435435
return
436436

src/sagemaker/local/image.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def _check_output(cmd, *popenargs, **kwargs):
619619

620620
output = output.decode("utf-8")
621621
if not success:
622-
logger.error("Command output: %s" % output)
622+
logger.error("Command output: %s", output)
623623
raise Exception("Failed to run %s" % ",".join(cmd))
624624

625625
return output
@@ -639,9 +639,9 @@ def _delete_tree(path):
639639
# files. We expect this to happen, so we handle EACCESS. Any other error we will raise the
640640
# exception up.
641641
if exc.errno == errno.EACCES:
642-
logger.warning("Failed to delete: %s Please remove it manually." % path)
642+
logger.warning("Failed to delete: %s Please remove it manually.", path)
643643
else:
644-
logger.error("Failed to delete: %s" % path)
644+
logger.error("Failed to delete: %s", path)
645645
raise
646646

647647

@@ -680,7 +680,7 @@ def _aws_credentials(session):
680680
)
681681
return None
682682
except Exception as e: # pylint: disable=broad-except
683-
logger.info("Could not get AWS credentials: %s" % e)
683+
logger.info("Could not get AWS credentials: %s", e)
684684

685685
return None
686686

0 commit comments

Comments
 (0)