Skip to content
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

bugfix/model-lifeycle-deletion #108

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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ cdk bootstrap -c email=$EMAIL -c account=$ACCOUNT -c region=$REGION -c source_br

This command creates a CodePipeline pipeline, this pipeline coordinates the build and deployment of all required DREM services.

Note - when deploying DREM in an account for the first time it may fail when creating AWS CodeStar Notifications, as the service-linked role for AWS CodeStar Notifications might not yet exist. Wait a few minutes, and then try again.

```sh
make install
```
Expand Down
10 changes: 8 additions & 2 deletions lib/lambdas/models_optimize/model_optimizer_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def lambda_handler(event, context):
model_key,
os.path.join(constants.APIDefaults.TMP_DIR, model_target_file),
)
# Get the tags of the downloaded file as we'
s3_object_tags = client_s3.get_object_tagging(
Bucket=src_bucket,
Key=model_key
)['TagSet']

if not os.path.isdir(model_target_dir):
os.makedirs(model_target_dir)
Expand All @@ -100,9 +105,10 @@ def lambda_handler(event, context):
return

try:
client_s3.upload_file(archive_file, src_bucket, model_key)
#Add the same tags as the downloaded file when uploading the optimized model
client_s3.upload_file(archive_file, src_bucket, model_key,ExtraArgs={'Tagging': '&'.join([f"{tag['Key']}={tag['Value']}" for tag in s3_object_tags])})
logger.info(
f"Uploading {archive_file} to s3://{src_bucket}/{model_key}"
f"Uploading {archive_file} to s3://{src_bucket}/{model_key} with tags {s3_object_tags}"
)
except ClientError as e:
logger.error(f"Error in uploading {archive_file}", e)
Expand Down