Skip to content

Commit 83bf026

Browse files
authored
Merge branch 'master' into processing-job-codeartifact-support
2 parents 4159681 + 52934e2 commit 83bf026

Some content is hidden

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

47 files changed

+1439
-310
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Security Monitoring
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * *'
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.run_id }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
id-token: write
13+
14+
jobs:
15+
check-code-scanning-alerts:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
code_scanning_alert_status: ${{ steps.check-code-scanning-alerts.outputs.code_scanning_alert_status }}
19+
steps:
20+
- name: Check for security alerts
21+
id: check-code-scanning-alerts
22+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
23+
with:
24+
github-token: ${{ secrets.GH_PAT }}
25+
script: |
26+
async function checkAlerts() {
27+
const owner = '${{ github.repository_owner }}';
28+
const repo = '${{ github.event.repository.name }}';
29+
const ref = 'refs/heads/master';
30+
31+
const codeScanningAlerts = await github.rest.codeScanning.listAlertsForRepo({
32+
owner,
33+
repo,
34+
ref: ref
35+
});
36+
const activeCodeScanningAlerts = codeScanningAlerts.data.filter(alert => alert.state === 'open');
37+
core.setOutput('code_scanning_alert_status', activeCodeScanningAlerts.length > 0 ? '1': '0');
38+
}
39+
await checkAlerts();
40+
41+
check-dependabot-alerts:
42+
runs-on: ubuntu-latest
43+
outputs:
44+
dependabot_alert_status: ${{ steps.check-dependabot-alerts.outputs.dependabot_alert_status }}
45+
steps:
46+
- name: Check for dependabot alerts
47+
id: check-dependabot-alerts
48+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
49+
with:
50+
github-token: ${{ secrets.GH_PAT }}
51+
script: |
52+
async function checkAlerts() {
53+
const owner = '${{ github.repository_owner }}';
54+
const repo = '${{ github.event.repository.name }}';
55+
56+
const dependabotAlerts = await github.rest.dependabot.listAlertsForRepo({
57+
owner,
58+
repo,
59+
headers: {
60+
'accept': 'applications/vnd.github+json'
61+
}
62+
});
63+
const activeDependabotAlerts = dependabotAlerts.data.filter(alert => alert.state === 'open');
64+
core.setOutput('dependabot_alert_status', activeDependabotAlerts.length > 0 ? '1': '0');
65+
}
66+
await checkAlerts();
67+
68+
check-secret-scanning-alerts:
69+
runs-on: ubuntu-latest
70+
outputs:
71+
secret_scanning_alert_status: ${{ steps.check-secret-scanning-alerts.outputs.secret_scanning_alert_status }}
72+
steps:
73+
- name: Check for secret scanning alerts
74+
id: check-secret-scanning-alerts
75+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
76+
with:
77+
github-token: ${{ secrets.GH_PAT }}
78+
script: |
79+
async function checkAlerts() {
80+
const owner = '${{ github.repository_owner }}';
81+
const repo = '${{ github.event.repository.name }}';
82+
83+
const secretScanningAlerts = await github.rest.secretScanning.listAlertsForRepo({
84+
owner,
85+
repo,
86+
});
87+
const activeSecretScanningAlerts = secretScanningAlerts.data.filter(alert => alert.state === 'open');
88+
core.setOutput('secret_scanning_alert_status', activeSecretScanningAlerts.length > 0 ? '1': '0');
89+
console.log("Active Secret Scanning Alerts", activeSecretScanningAlerts);
90+
}
91+
await checkAlerts();
92+
93+
put-metric-data:
94+
runs-on: ubuntu-latest
95+
needs: [check-code-scanning-alerts, check-dependabot-alerts, check-secret-scanning-alerts]
96+
steps:
97+
- name: Configure AWS Credentials
98+
uses: aws-actions/configure-aws-credentials@12e3392609eaaceb7ae6191b3f54bbcb85b5002b
99+
with:
100+
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
101+
aws-region: us-west-2
102+
- name: Put Code Scanning Alert Metric Data
103+
run: |
104+
if [ "${{ needs.check-code-scanning-alerts.outputs.code_scanning_alert_status }}" == "1" ]; then
105+
aws cloudwatch put-metric-data --metric-name CodeScanningAlert --namespace SecurityMonitoringMetrics --value 1 --unit Count --dimensions ProjectName=sagemaker-python-sdk
106+
else
107+
aws cloudwatch put-metric-data --metric-name CodeScanningAlert --namespace SecurityMonitoringMetrics --value 0 --unit Count --dimensions ProjectName=sagemaker-python-sdk
108+
fi
109+
- name: Put Dependabot Alert Metric Data
110+
run: |
111+
if [ "${{ needs.check-dependabot-alerts.outputs.dependabot_alert_status }}" == "1" ]; then
112+
aws cloudwatch put-metric-data --metric-name DependabotAlert --namespace SecurityMonitoringMetrics --value 1 --unit Count --dimensions ProjectName=sagemaker-python-sdk
113+
else
114+
aws cloudwatch put-metric-data --metric-name DependabotAlert --namespace SecurityMonitoringMetrics --value 0 --unit Count --dimensions ProjectName=sagemaker-python-sdk
115+
fi
116+
- name: Put Secret Scanning Alert Metric Data
117+
run: |
118+
if [ "${{ needs.check-secret-scanning-alerts.outputs.secret_scanning_alert_status }}" == "1" ]; then
119+
aws cloudwatch put-metric-data --metric-name SecretScanningAlert --namespace SecurityMonitoringMetrics --value 1 --unit Count --dimensions ProjectName=sagemaker-python-sdk
120+
else
121+
aws cloudwatch put-metric-data --metric-name SecretScanningAlert --namespace SecurityMonitoringMetrics --value 0 --unit Count --dimensions ProjectName=sagemaker-python-sdk
122+
fi

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## v2.228.0 (2024-08-06)
4+
5+
### Features
6+
7+
* triton v24.05
8+
9+
### Bug Fixes and Other Changes
10+
11+
* chore: telemetry for deployment configs
12+
* censoring sensitive values from being logged
13+
* update image_uri_configs 08-05-2024 07:17:38 PST
14+
* enable uncompressed model artifacts upload to S3 for SAGEMAKER_ENDPOINT overwrite for TGI, TEI, MMS model servers
15+
* ModelReference deployment for Alt Configs models
16+
* Add optional typecheck for nullable parameters
17+
* Update package metadata
18+
* release TEI 1.4.0
19+
320
## v2.227.0 (2024-07-30)
421

522
### Features

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.227.1.dev0
1+
2.228.1.dev0

requirements/extras/test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ awslogs==0.14.0
1313
black==24.3.0
1414
stopit==1.1.2
1515
# Update tox.ini to have correct version of airflow constraints file
16-
apache-airflow==2.9.2
16+
apache-airflow==2.9.3
1717
apache-airflow-providers-amazon==7.2.1
1818
attrs>=23.1.0,<24
1919
fabric==2.6.0

src/sagemaker/config/config_utils.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import logging
2121
import sys
2222
from typing import Callable
23+
import re
24+
from copy import deepcopy
2325

2426

2527
def get_sagemaker_config_logger():
@@ -67,6 +69,19 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
6769
"""
6870
logger = get_sagemaker_config_logger()
6971

72+
source_value_log_copy = deepcopy(source_value)
73+
config_value_log_copy = deepcopy(config_value)
74+
75+
if isinstance(source_value_log_copy, dict):
76+
for key in source_value_log_copy.keys():
77+
if re.search(r"(secret|password|key|token)", key, re.IGNORECASE):
78+
source_value_log_copy[key] = "***"
79+
80+
if isinstance(config_value_log_copy, dict):
81+
for key in config_value_log_copy.keys():
82+
if re.search(r"(secret|password|key|token)", key, re.IGNORECASE):
83+
config_value_log_copy[key] = "***"
84+
7085
if config_value is not None:
7186

7287
if source_value is None:
@@ -79,7 +94,7 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
7994
logger.debug(
8095
"Applied value\n config key = %s\n config value that will be used = %s",
8196
config_key_path,
82-
config_value,
97+
config_value_log_copy,
8398
)
8499
else:
85100
logger.info(
@@ -102,8 +117,8 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
102117
" source value that will be used = %s"
103118
),
104119
config_key_path,
105-
config_value,
106-
source_value,
120+
config_value_log_copy,
121+
source_value_log_copy,
107122
)
108123
elif source_value is not None and config_value != source_value:
109124
# Sagemaker Config had a value defined that is NOT going to be used
@@ -117,8 +132,8 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
117132
" source value that will be used = %s",
118133
),
119134
config_key_path,
120-
config_value,
121-
source_value,
135+
config_value_log_copy,
136+
source_value_log_copy,
122137
)
123138
else:
124139
# nothing was specified in the config and nothing is being automatically applied

src/sagemaker/image_uri_config/pytorch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,6 +2378,7 @@
23782378
"us-gov-west-1": "442386744353",
23792379
"us-iso-east-1": "886529160074",
23802380
"us-isob-east-1": "094389454867",
2381+
"us-isof-east-1": "303241398832",
23812382
"us-isof-south-1": "454834333376",
23822383
"us-west-1": "763104351884",
23832384
"us-west-2": "763104351884"

src/sagemaker/image_uri_config/sagemaker-tritonserver.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,38 @@
77
"inference"
88
],
99
"versions": {
10+
"24.05": {
11+
"registries": {
12+
"af-south-1": "626614931356",
13+
"il-central-1": "780543022126",
14+
"ap-east-1": "871362719292",
15+
"ap-northeast-1": "763104351884",
16+
"ap-northeast-2": "763104351884",
17+
"ap-northeast-3": "364406365360",
18+
"ap-south-1": "763104351884",
19+
"ap-southeast-1": "763104351884",
20+
"ap-southeast-2": "763104351884",
21+
"ap-southeast-3": "907027046896",
22+
"ca-central-1": "763104351884",
23+
"cn-north-1": "727897471807",
24+
"cn-northwest-1": "727897471807",
25+
"eu-central-1": "763104351884",
26+
"eu-north-1": "763104351884",
27+
"eu-west-1": "763104351884",
28+
"eu-west-2": "763104351884",
29+
"eu-west-3": "763104351884",
30+
"eu-south-1": "692866216735",
31+
"me-south-1": "217643126080",
32+
"sa-east-1": "763104351884",
33+
"us-east-1": "763104351884",
34+
"us-east-2": "763104351884",
35+
"us-west-1": "763104351884",
36+
"us-west-2": "763104351884",
37+
"ca-west-1": "204538143572"
38+
},
39+
"repository": "sagemaker-tritonserver",
40+
"tag_prefix": "24.05-py3"
41+
},
1042
"24.03": {
1143
"registries": {
1244
"af-south-1": "626614931356",
@@ -104,4 +136,4 @@
104136
"tag_prefix": "23.12-py3"
105137
}
106138
}
107-
}
139+
}

src/sagemaker/image_uri_config/tensorflow.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,6 +4401,7 @@
44014401
"us-gov-west-1": "442386744353",
44024402
"us-iso-east-1": "886529160074",
44034403
"us-isob-east-1": "094389454867",
4404+
"us-isof-east-1": "303241398832",
44044405
"us-isof-south-1": "454834333376",
44054406
"us-west-1": "763104351884",
44064407
"us-west-2": "763104351884"

src/sagemaker/jumpstart/factory/estimator.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
add_jumpstart_model_info_tags,
7070
get_eula_message,
7171
get_default_jumpstart_session_with_user_agent_suffix,
72+
get_top_ranked_config_name,
7273
update_dict_if_key_not_present,
7374
resolve_estimator_sagemaker_config_field,
7475
verify_model_region_and_return_specs,
@@ -204,7 +205,9 @@ def get_init_kwargs(
204205

205206
estimator_init_kwargs = _add_model_version_to_kwargs(estimator_init_kwargs)
206207
estimator_init_kwargs = _add_vulnerable_and_deprecated_status_to_kwargs(estimator_init_kwargs)
207-
estimator_init_kwargs = _add_sagemaker_session_to_kwargs(estimator_init_kwargs)
208+
estimator_init_kwargs = _add_sagemaker_session_with_custom_user_agent_to_kwargs(
209+
estimator_init_kwargs
210+
)
208211
estimator_init_kwargs = _add_region_to_kwargs(estimator_init_kwargs)
209212
estimator_init_kwargs = _add_instance_type_and_count_to_kwargs(estimator_init_kwargs)
210213
estimator_init_kwargs = _add_image_uri_to_kwargs(estimator_init_kwargs)
@@ -438,12 +441,17 @@ def _add_region_to_kwargs(kwargs: JumpStartKwargs) -> JumpStartKwargs:
438441
return kwargs
439442

440443

441-
def _add_sagemaker_session_to_kwargs(kwargs: JumpStartKwargs) -> JumpStartKwargs:
444+
def _add_sagemaker_session_with_custom_user_agent_to_kwargs(
445+
kwargs: JumpStartKwargs,
446+
) -> JumpStartKwargs:
442447
"""Sets session in kwargs based on default or override, returns full kwargs."""
443448
kwargs.sagemaker_session = (
444449
kwargs.sagemaker_session
445450
or get_default_jumpstart_session_with_user_agent_suffix(
446-
kwargs.model_id, kwargs.model_version, kwargs.hub_arn
451+
model_id=kwargs.model_id,
452+
model_version=kwargs.model_version,
453+
config_name=None,
454+
is_hub_content=kwargs.hub_arn is not None,
447455
)
448456
)
449457
return kwargs
@@ -903,20 +911,16 @@ def _add_config_name_to_kwargs(
903911
) -> JumpStartEstimatorInitKwargs:
904912
"""Sets tags in kwargs based on default or override, returns full kwargs."""
905913

906-
specs = verify_model_region_and_return_specs(
914+
kwargs.config_name = kwargs.config_name or get_top_ranked_config_name(
915+
region=kwargs.region,
907916
model_id=kwargs.model_id,
908-
version=kwargs.model_version,
917+
model_version=kwargs.model_version,
918+
sagemaker_session=kwargs.sagemaker_session,
909919
scope=JumpStartScriptScope.TRAINING,
910-
region=kwargs.region,
911-
tolerate_vulnerable_model=kwargs.tolerate_vulnerable_model,
920+
model_type=kwargs.model_type,
912921
tolerate_deprecated_model=kwargs.tolerate_deprecated_model,
913-
sagemaker_session=kwargs.sagemaker_session,
914-
config_name=kwargs.config_name,
922+
tolerate_vulnerable_model=kwargs.tolerate_vulnerable_model,
923+
hub_arn=kwargs.hub_arn,
915924
)
916925

917-
if specs.training_configs and specs.training_configs.get_top_config_from_ranking():
918-
kwargs.config_name = (
919-
kwargs.config_name or specs.training_configs.get_top_config_from_ranking().config_name
920-
)
921-
922926
return kwargs

0 commit comments

Comments
 (0)