Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit b761be0

Browse files
authored
Merge pull request #9 from aws-solutions/feature/v1.1.0
Release candidate/v1.1.0
2 parents ef66199 + 70270dc commit b761be0

File tree

123 files changed

+4400
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+4400
-506
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Steps to reproduce the behavior.
1717
A clear and concise description of what you expected to happen.
1818

1919
**Please complete the following information about the solution:**
20-
- [ ] Version: [e.g. v1.0.0]
20+
- [ ] Version: [e.g. v0.0.1]
2121

2222
To get the version of the solution, you can look at the description of the created CloudFormation stack. For example, "(SO0170) Maintaining Personalized Experiences with Machine Learning [...]".
2323

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ __pycache__/
4848
# Generated test assets
4949
source/infrastructure/tests/assets/*
5050
!source/infrastructure/tests/assets/.keep
51-
source/aws_lambda/get_next_scheduled_event/.gradle
52-
source/aws_lambda/get_next_scheduled_event/build
53-
source/aws_lambda/get_next_scheduled_event/.idea
51+
source/scheduler/cdk/aws_solutions/scheduler/cdk/aws_lambda/get_next_scheduled_event/build
52+
source/scheduler/cdk/aws_solutions/scheduler/cdk/aws_lambda/get_next_scheduled_event/.gradle
53+
source/scheduler/cdk/aws_solutions/scheduler/cdk/aws_lambda/get_next_scheduled_event/.idea
5454

5555
# gradle build files
5656
**/.gradle/*
@@ -60,4 +60,6 @@ source/aws_lambda/get_next_scheduled_event/.idea
6060

6161
# python build files
6262
source/cdk_solution_helper_py/helpers_cdk/build/*
63-
source/cdk_solution_helper_py/helpers_common/build/*
63+
source/cdk_solution_helper_py/helpers_common/build/*
64+
source/scheduler/common/build/*
65+
source/scheduler/cdk/build/*

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.1.0] - 2021-11-22
8+
### Added
9+
- The solution now creates an Amazon EventBridge event bus, and puts messages to the bus when resources have been
10+
created by the workflow. This can be useful when integrating with external systems.
11+
- The solution now contains a command line interface (CLI) that allows schedule creation for existing resources in
12+
Amazon Personalize.
13+
714
## [1.0.1] - 2021-10-01
815
### Added
916
- The solution now exports the Amazon SNS Topic ARN as `SNSTopicArn`.

NOTICE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pytest-env under the Massachusetts Institute of Technology (MIT) license
3434
PyYAML under the Massachusetts Institute of Technology (MIT) license
3535
requests under the Apache License Version 2.0
3636
requests-mock under the Apache License Version 2.0
37+
rich under the Massachusetts Institute of Technology (MIT) license
3738
tenacity under the Apache License Version 2.0
3839
quartz-scheduler under the Apache License Version 2.0
3940

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ The template includes the following components:
3535
2. Perform solution FULL retraining on schedule (and update associated campaigns)
3636
3. Perform solution UPDATE retraining on schedule (and update associated campaigns)
3737
4. Create batch inference jobs
38+
9. An Amazon EventBridge event bus, where resource status notification updates are posted throughout the AWS Step
39+
functions workflow
40+
10. A command line interface (CLI) lets existing resources be imported and allows schedules to be established for
41+
resources that already exist in Amazon Personalize
3842

3943

4044
**Note**: From v1.0.0, AWS CloudFormation template resources are created by the [AWS CDK](https://aws.amazon.com/cdk/)
@@ -287,9 +291,9 @@ To customize the solution, follow the steps below:
287291
The following procedures assumes that all the OS-level configuration has been completed. They are:
288292

289293
* [AWS Command Line Interface](https://aws.amazon.com/cli/)
290-
* [Python](https://www.python.org/) 3.7 or newer
294+
* [Python](https://www.python.org/) 3.9 or newer
291295
* [Node.js](https://nodejs.org/en/) 16.x or newer
292-
* [AWS CDK](https://aws.amazon.com/cdk/) 1.95.2 or newer
296+
* [AWS CDK](https://aws.amazon.com/cdk/) 1.126.0 or newer
293297
* [Amazon Corretto OpenJDK](https://docs.aws.amazon.com/corretto/) 11
294298

295299
> **Please ensure you test the templates before updating any production deployments.**
@@ -360,7 +364,7 @@ build-s3-cdk-dist \
360364
S3 bucket where the name is `<DIST_BUCKET_PREFIX>-<REGION_NAME>`. The solution's CloudFormation template will expect the
361365
source code to be located in the bucket matching that name.
362366
- `$SOLUTION_NAME` - The name of This solution (example: personalize-solution-customization)
363-
- `$VERSION` - The version number to use (example: v1.0.1)
367+
- `$VERSION` - The version number to use (example: v0.0.1)
364368
- `$REGION_NAME` - The region name to use (example: us-east-1)
365369

366370
This will result in all global assets being pushed to the `DIST_BUCKET_PREFIX`, and all regional assets being pushed to

source/.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ source =
77
infrastructure
88
aws_lambda
99
cdk_solution_helper_py
10+
scheduler
1011

1112
[report]
1213
fail_under = 80.0

source/aws_lambda/create_batch_inference_job/handler.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
"default": "omit",
6565
"as": "seconds",
6666
},
67+
"timeStarted": {
68+
"source": "event",
69+
"path": "workflowConfig.timeStarted",
70+
"default": "omit",
71+
"as": "iso8601",
72+
},
6773
},
6874
)
6975
def lambda_handler(event: Dict[str, Any], context: LambdaContext) -> Dict:

source/aws_lambda/create_campaign/handler.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,14 @@
5252
"default": "omit",
5353
"as": "seconds",
5454
},
55+
"timeStarted": {
56+
"source": "event",
57+
"path": "workflowConfig.timeStarted",
58+
"default": "omit",
59+
"as": "iso8601",
60+
},
5561
},
56-
status="campaign.status",
62+
status="campaign.latestCampaignUpdate.status || campaign.status",
5763
)
5864
def lambda_handler(event: Dict[str, Any], context: LambdaContext) -> Dict:
5965
"""Create a campaign in Amazon Personalize based on the configuration in `event`
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# ######################################################################################################################
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3+
# #
4+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance #
5+
# with the License. You may obtain a copy of the License at #
6+
# #
7+
# http://www.apache.org/licenses/LICENSE-2.0 #
8+
# #
9+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed #
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for #
11+
# the specific language governing permissions and limitations under the License. #
12+
# ######################################################################################################################
13+
import json
14+
import os
15+
16+
from aws_lambda_powertools import Logger, Tracer, Metrics
17+
from aws_lambda_powertools.metrics import MetricUnit
18+
from aws_lambda_powertools.utilities.data_classes import S3Event
19+
20+
from shared.personalize.service_model import ServiceModel
21+
from shared.personalize_service import Personalize
22+
23+
24+
logger = Logger()
25+
tracer = Tracer()
26+
metrics = Metrics()
27+
28+
29+
@metrics.log_metrics
30+
@tracer.capture_lambda_handler
31+
def lambda_handler(event, context):
32+
"""Generate and return a solution configuration file derived from the properties of a dataset group
33+
:param dict event: AWS Lambda Event (in this case, the dataset group and schedules)
34+
:param context: AWS Lambda Context
35+
:return: Dict
36+
"""
37+
dataset_group_name = event["datasetGroupName"]
38+
schedules = event.get("schedules")
39+
40+
cli = Personalize()
41+
model = ServiceModel(cli, dataset_group_name=dataset_group_name)
42+
return model.get_config(dataset_group_name=dataset_group_name, schedules=schedules)

0 commit comments

Comments
 (0)