Skip to content

change: enable logging-not-lazy pylint check #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ disable=
line-too-long, # We let Flake8 take care of this # TODO: Fix these and stop relying on flake8
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
import-error, # TODO: Fix import errors
logging-not-lazy, # TODO: Fix logging
attribute-defined-outside-init, # TODO: Fix scope
protected-access, # TODO: Fix access
abstract-method, # TODO: Fix abstract methods
Expand Down
6 changes: 3 additions & 3 deletions src/sagemaker/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ def training_job_summaries(self, force_refresh=False):
output = []
next_args = {}
for count in range(100):
logging.debug("Calling list_training_jobs_for_hyper_parameter_tuning_job %d" % count)
logging.debug("Calling list_training_jobs_for_hyper_parameter_tuning_job %d", count)
raw_result = self._sage_client.list_training_jobs_for_hyper_parameter_tuning_job(
HyperParameterTuningJobName=self.name, MaxResults=100, **next_args
)
new_output = raw_result["TrainingJobSummaries"]
output.extend(new_output)
logging.debug(
"Got %d more TrainingJobs. Total so far: %d" % (len(new_output), len(output))
"Got %d more TrainingJobs. Total so far: %d", len(new_output), len(output)
)
if ("NextToken" in raw_result) and (len(new_output) > 0):
next_args["NextToken"] = raw_result["NextToken"]
Expand Down Expand Up @@ -296,7 +296,7 @@ def _fetch_metric(self, metric_name):
}
raw_cwm_data = self._cloudwatch.get_metric_statistics(**request)["Datapoints"]
if len(raw_cwm_data) == 0:
logging.warning("Warning: No metrics called %s found" % metric_name)
logging.warning("Warning: No metrics called %s found", metric_name)
return

# Process data: normalize to starting time, and sort.
Expand Down
4 changes: 2 additions & 2 deletions src/sagemaker/local/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ def _wait_for_serving_container(serving_port):
if i >= HEALTH_CHECK_TIMEOUT_LIMIT:
raise RuntimeError("Giving up, endpoint didn't launch correctly")

logger.info("Checking if serving container is up, attempt: %s" % i)
logger.info("Checking if serving container is up, attempt: %s", i)
_, code = _perform_request(endpoint_url, http)
if code != 200:
logger.info("Container still not up, got: %s" % code)
logger.info("Container still not up, got: %s", code)
else:
return

Expand Down
8 changes: 4 additions & 4 deletions src/sagemaker/local/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def _check_output(cmd, *popenargs, **kwargs):

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

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


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

return None

Expand Down