Skip to content

fix: update to incorporate black v22, pin tox versions #2889

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 6 commits into from
Feb 3, 2022
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
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import pkg_resources
from datetime import datetime

project = u"sagemaker"
project = "sagemaker"
version = pkg_resources.require(project)[0].version

# Add any Sphinx extension module names here, as strings. They can be extensions
Expand All @@ -38,7 +38,7 @@
source_suffix = ".rst" # The suffix of source filenames.
master_doc = "index" # The master toctree document.

copyright = u"%s, Amazon" % datetime.now().year
copyright = "%s, Amazon" % datetime.now().year

# The full version, including alpha/beta/rc tags.
release = version
Expand Down
10 changes: 7 additions & 3 deletions src/sagemaker/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ def training_job_summaries(self, force_refresh=False):
)
new_output = raw_result["TrainingJobSummaries"]
output.extend(new_output)
logger.debug("Got %d more TrainingJobs. Total so far: %d", len(new_output), len(output))
logger.debug(
"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"]
else:
Expand Down Expand Up @@ -344,7 +348,7 @@ def _determine_timeinterval(self):
a dict with the `start_time` and `end_time`.
"""
description = self._sage_client.describe_training_job(TrainingJobName=self.name)
start_time = self._start_time or description[u"TrainingStartTime"] # datetime object
start_time = self._start_time or description["TrainingStartTime"] # datetime object
# Incrementing end time by 1 min since CloudWatch drops seconds before finding the logs.
# This results in logs being searched in the time range in which the correct log line was
# not present.
Expand All @@ -353,7 +357,7 @@ def _determine_timeinterval(self):
# CW will consider end time as 2018-10-22 08:25 and will not be able to search the
# correct log.
end_time = self._end_time or description.get(
u"TrainingEndTime", datetime.datetime.utcnow()
"TrainingEndTime", datetime.datetime.utcnow()
) + datetime.timedelta(minutes=1)

return {"start_time": start_time, "end_time": end_time}
Expand Down
15 changes: 12 additions & 3 deletions src/sagemaker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def name_from_base(base, max_length=63, short=False):

def unique_name_from_base(base, max_length=63):
"""Placeholder Docstring"""
unique = "%04x" % random.randrange(16 ** 4) # 4-digit hex
unique = "%04x" % random.randrange(16**4) # 4-digit hex
ts = str(int(time.time()))
available_length = max_length - 2 - len(ts) - len(unique)
trimmed = base[:available_length]
Expand Down Expand Up @@ -413,7 +413,12 @@ def repack_model(
model_dir = _extract_model(model_uri, sagemaker_session, tmp)

_create_or_update_code_dir(
model_dir, inference_script, source_directory, dependencies, sagemaker_session, tmp
model_dir,
inference_script,
source_directory,
dependencies,
sagemaker_session,
tmp,
)

tmp_model_path = os.path.join(tmp, "temp-model.tar.gz")
Expand Down Expand Up @@ -544,7 +549,11 @@ def sts_regional_endpoint(region):
return "https://{}".format(endpoint_data["hostname"])


def retries(max_retry_count, exception_message_prefix, seconds_to_sleep=DEFAULT_SLEEP_TIME_SECONDS):
def retries(
max_retry_count,
exception_message_prefix,
seconds_to_sleep=DEFAULT_SLEEP_TIME_SECONDS,
):
"""Retries until max retry count is reached.

Args:
Expand Down
2 changes: 1 addition & 1 deletion tests/data/multimodel/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get update && \
curl \
vim \
&& rm -rf /var/lib/apt/lists/* \
&& curl -O https://bootstrap.pypa.io/get-pip.py \
&& curl -O https://bootstrap.pypa.io/pip/3.6/get-pip.py \
&& python3 get-pip.py

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
Expand Down
2 changes: 1 addition & 1 deletion tests/integ/sagemaker/lineage/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def retry(callable, num_attempts=8):
if i == num_attempts - 1:
raise ex
print("Retrying", ex)
time.sleep(2 ** i)
time.sleep(2**i)
assert False, "logic error in retry"


Expand Down
Loading