|
22 | 22 | import logging |
23 | 23 | import uuid |
24 | 24 |
|
25 | | -from six.moves.urllib.parse import urlparse |
26 | 25 | from six import string_types |
27 | | - |
| 26 | +from six.moves.urllib.parse import urlparse |
28 | 27 | from botocore.exceptions import ClientError |
29 | 28 |
|
| 29 | +from sagemaker.exceptions import UnexpectedStatusException |
| 30 | +from sagemaker.model_monitor.monitoring_files import Constraints, ConstraintViolations, Statistics |
30 | 31 | from sagemaker.network import NetworkConfig |
| 32 | +from sagemaker.processing import Processor, ProcessingInput, ProcessingJob, ProcessingOutput |
31 | 33 | from sagemaker.s3 import S3Uploader |
32 | | - |
33 | | -from sagemaker.utils import name_from_base |
34 | 34 | from sagemaker.session import Session |
35 | | -from sagemaker.processing import Processor |
36 | | -from sagemaker.processing import ProcessingJob |
37 | | -from sagemaker.processing import ProcessingInput |
38 | | -from sagemaker.processing import ProcessingOutput |
39 | | -from sagemaker.model_monitor.monitoring_files import Constraints, ConstraintViolations |
40 | | -from sagemaker.model_monitor.monitoring_files import Statistics |
41 | | -from sagemaker.exceptions import UnexpectedStatusException |
42 | | -from sagemaker.utils import retries |
| 35 | +from sagemaker.utils import name_from_base, retries |
43 | 36 |
|
44 | 37 | _DEFAULT_MONITOR_IMAGE_URI_WITH_PLACEHOLDERS = ( |
45 | 38 | "{}.dkr.ecr.{}.amazonaws.com/sagemaker-model-monitor-analyzer" |
@@ -390,7 +383,7 @@ def update_monitoring_schedule( |
390 | 383 | network_config (sagemaker.network.NetworkConfig): A NetworkConfig |
391 | 384 | object that configures network isolation, encryption of |
392 | 385 | inter-container traffic, security group IDs, and subnets. |
393 | | - role (str): An AWS IAM role. The Amazon SageMaker jobs use this role. |
| 386 | + role (str): An AWS IAM role name or ARN. The Amazon SageMaker jobs use this role. |
394 | 387 | image_uri (str): The uri of the image to use for the jobs started by |
395 | 388 | the Monitor. |
396 | 389 |
|
@@ -452,7 +445,7 @@ def update_monitoring_schedule( |
452 | 445 | self.network_config = network_config |
453 | 446 |
|
454 | 447 | if role is not None: |
455 | | - self.role = role |
| 448 | + self.role = self.sagemaker_session.expand_role(role) |
456 | 449 |
|
457 | 450 | if image_uri is not None: |
458 | 451 | self.image_uri = image_uri |
@@ -988,7 +981,7 @@ def __init__( |
988 | 981 | creating Amazon SageMaker Monitoring Schedules to monitor SageMaker endpoints. |
989 | 982 |
|
990 | 983 | Args: |
991 | | - role (str): An AWS IAM role. The Amazon SageMaker jobs use this role. |
| 984 | + role (str): An AWS IAM role name or ARN. The Amazon SageMaker jobs use this role. |
992 | 985 | instance_count (int): The number of instances to run the jobs with. |
993 | 986 | instance_type (str): Type of EC2 instance to use for the job, for example, |
994 | 987 | 'ml.m5.xlarge'. |
@@ -1355,7 +1348,7 @@ def update_monitoring_schedule( |
1355 | 1348 | inter-container traffic, security group IDs, and subnets. |
1356 | 1349 | enable_cloudwatch_metrics (bool): Whether to publish cloudwatch metrics as part of |
1357 | 1350 | the baselining or monitoring jobs. |
1358 | | - role (str): An AWS IAM role. The Amazon SageMaker jobs use this role. |
| 1351 | + role (str): An AWS IAM role name or ARN. The Amazon SageMaker jobs use this role. |
1359 | 1352 |
|
1360 | 1353 | """ |
1361 | 1354 | monitoring_inputs = None |
@@ -1431,7 +1424,7 @@ def update_monitoring_schedule( |
1431 | 1424 | network_config_dict = self.network_config._to_request_dict() |
1432 | 1425 |
|
1433 | 1426 | if role is not None: |
1434 | | - self.role = role |
| 1427 | + self.role = self.sagemaker_session.expand_role(role) |
1435 | 1428 |
|
1436 | 1429 | self.sagemaker_session.update_monitoring_schedule( |
1437 | 1430 | monitoring_schedule_name=self.monitoring_schedule_name, |
|
0 commit comments