-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor ML Ops to multiple workflows * rewrite ML Ops in native HCL, wrapped in `jsonencode()` * terraform fmt compliance for 0.14.0 * glue version fix * rename 'batch_transform'->'batch_scoring' * skip ecr push if using builtin sagemaker model * pip and python fixes * improved lambda and step function execution * bump to terraform 0.14.2 * revert to upstream 'terraform-aws-key-pair' repo * fix interpolation warnings Co-authored-by: Mark Stein <mark.stein@slalom.com> Co-authored-by: mystycs <mystycs@gmail.com> Co-authored-by: jacksandom <jack.sandom@slalom.com>
- Loading branch information
1 parent
ab8e462
commit 94289b8
Showing
61 changed files
with
957 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.9.6 | ||
0.9.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...l-ops/lambda-python/extract_model_path.py → ...a-python/core-model/extract_model_path.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...lambda-python/cloudwatch_model_metrics.py → ...tion/cloudwatch_model_metrics.py.disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...-ops/lambda-python/determine_prob_type.py → ...on/drift-detection/determine_prob_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
""" | ||
This is a simply function to return the machine learning problem type | ||
This is a simply function to return the machine learning problem type | ||
""" | ||
|
||
problem = "${var.data_drift_ml_problem_type}" | ||
|
||
|
||
def lambda_hanlder(event, context): | ||
def lambda_handler(event, context): | ||
response = problem | ||
return response | ||
|
52 changes: 52 additions & 0 deletions
52
catalog/aws/ml-ops/lambda-python/drift-detection/load_predoutput_db.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
This function will load model prediction outputs from S3 bucket to a selected database platform such as PostgreSQL. | ||
""" | ||
|
||
# import boto3 | ||
import psycopg2 | ||
|
||
|
||
def handler(event, context): | ||
# Load csv to Postgres | ||
|
||
# first need to enable the prediction outputs loading process | ||
is_predictive_db_enabled = event.get("is_predictive_db_enabled", False) | ||
if not is_predictive_db_enabled: | ||
return | ||
|
||
# user defined database related variables | ||
host = event.get("db_host", None) | ||
db_name = event.get("db_name", None) | ||
db_user = event.get("db_user", None) | ||
db_password = event.get("db_password", None) | ||
s3_csv = event.get("s3_csv", None) | ||
|
||
connection_string = ( | ||
f"dbname='{db_name}' user='{db_user}' host='{host}' password='{db_password}'" | ||
) | ||
|
||
pg_load(connection_string, s3_csv) | ||
|
||
|
||
def pg_load(connection, file_path, table_name="model_stats"): | ||
try: | ||
conn = psycopg2.connect(connection) | ||
print("Connecting to Database") | ||
cur = conn.cursor() | ||
# Open the input file for copy | ||
# s3_client = boto3.client("s3") | ||
f = open(file_path, "r") | ||
# Load csv file into the table | ||
cur.copy_expert( | ||
"COPY {} FROM STDIN WITH CSV QUOTE e'\x01' DELIMITER e'\x02'".format( | ||
table_name | ||
), | ||
f, | ||
) | ||
cur.execute("commit;") | ||
print("Loaded data into {}".format(table_name)) | ||
conn.close() | ||
print("DB connection closed.") | ||
|
||
except Exception as e: | ||
print("Error {}".format(str(e))) |
5 changes: 5 additions & 0 deletions
5
catalog/aws/ml-ops/lambda-python/drift-detection/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Used in drift detection | ||
psycopg2-binary | ||
|
||
# Used for S3 and Sagemaker | ||
boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.