Skip to content

Allow local deployments of public models without requiring AWS creds #1589

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
Nov 23, 2020
Merged
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
2 changes: 1 addition & 1 deletion pkg/workloads/cortex/lib/api/predictor.py
Original file line number Diff line number Diff line change
@@ -523,7 +523,7 @@ def model_downloader(
f"downloading from bucket {bucket_name}/{model_path}, model {model_name} of version {model_version}, temporarily to {temp_dir} and then finally to {model_dir}"
)

s3_client = S3(bucket_name, client_config={})
s3_client = S3(bucket_name)

# validate upstream S3 model
sub_paths, ts = s3_client.search(model_path)
8 changes: 4 additions & 4 deletions pkg/workloads/cortex/lib/model/cron.py
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ def find_all_s3_models(
# validate models stored in S3 that were specified with predictor:models:dir field
if is_dir_used:
bucket_name, models_path = S3.deconstruct_s3_path(models_dir)
s3_client = S3(bucket_name, client_config={})
s3_client = S3(bucket_name)
sub_paths, timestamps = s3_client.search(models_path)
model_paths, ooa_ids = validate_models_dir_paths(sub_paths, predictor_type, models_path)
model_names = [os.path.basename(model_path) for model_path in model_paths]
@@ -171,7 +171,7 @@ def find_all_s3_models(
for idx, path in enumerate(s3_paths):
if S3.is_valid_s3_path(path):
bucket_name, model_path = S3.deconstruct_s3_path(path)
s3_client = S3(bucket_name, client_config={})
s3_client = S3(bucket_name)
sb, model_path_ts = s3_client.search(model_path)
try:
ooa_ids.append(validate_model_paths(sb, predictor_type, model_path))
@@ -451,7 +451,7 @@ def _refresh_model(
sub_paths: List[str],
bucket_name: str,
) -> None:
s3_client = S3(bucket_name, client_config={})
s3_client = S3(bucket_name)

ondisk_model_path = os.path.join(self._download_dir, model_name)
for version, model_ts in zip(versions, timestamps):
@@ -1059,7 +1059,7 @@ def _refresh_model(
sub_paths: List[str],
bucket_name: str,
) -> None:
s3_client = S3(bucket_name, client_config={})
s3_client = S3(bucket_name)

ondisk_model_path = os.path.join(self._download_dir, model_name)
for version, model_ts in zip(versions, timestamps):
3 changes: 3 additions & 0 deletions pkg/workloads/cortex/lib/storage/s3.py
Original file line number Diff line number Diff line change
@@ -37,6 +37,9 @@ def __init__(self, bucket=None, region=None, client_config={}):
if region is not None:
client_config["region_name"] = region

if not (os.getenv("AWS_ACCESS_KEY_ID") and os.getenv("AWS_SECRET_ACCESS_KEY")):
client_config["config"] = botocore.client.Config(signature_version=botocore.UNSIGNED)

self.s3 = boto3.client("s3", **client_config)

@staticmethod