workbench 0.8.175__py3-none-any.whl → 0.8.176__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of workbench might be problematic. Click here for more details.

@@ -238,8 +238,8 @@ class Artifact(ABC):
238
238
  """
239
239
 
240
240
  # Check for ReadOnly Role
241
- if self.aws_account_clamp.read_only_role:
242
- self.log.info("Cannot add metadata with a ReadOnly Role...")
241
+ if self.aws_account_clamp.read_only:
242
+ self.log.info("Cannot add metadata with a ReadOnly Permissions...")
243
243
  return
244
244
 
245
245
  # Sanity check
@@ -55,9 +55,10 @@ class AWSAccountClamp:
55
55
  # Check our Assume Role
56
56
  self.log.info("Checking Workbench Assumed Role...")
57
57
  role_info = self.aws_session.assumed_role_info()
58
+ self.log.info(f"Assumed Role: {role_info}")
58
59
 
59
- # Check if the Role is a 'ReadOnly' role
60
- self.read_only_role = "readonly" in role_info["AssumedRoleArn"].lower()
60
+ # Check if we have tag write permissions (if we don't, we are read-only)
61
+ self.read_only = not self.check_tag_permissions()
61
62
 
62
63
  # Check our Workbench API Key and Load the License
63
64
  self.log.info("Checking Workbench API License...")
@@ -141,6 +142,45 @@ class AWSAccountClamp:
141
142
  """
142
143
  return self.boto3_session.client("sagemaker")
143
144
 
145
+ def check_tag_permissions(self):
146
+ """Check if current role has permission to add tags to SageMaker endpoints.
147
+
148
+ Returns:
149
+ bool: True if AddTags is allowed, False otherwise
150
+ """
151
+ try:
152
+ sagemaker = self.boto3_session.client("sagemaker")
153
+
154
+ # Use a non-existent endpoint name
155
+ fake_endpoint = "workbench-permission-check-dummy-endpoint"
156
+
157
+ # Try to add tags to the non-existent endpoint
158
+ sagemaker.add_tags(
159
+ ResourceArn=f"arn:aws:sagemaker:{self.region}:{self.account_id}:endpoint/{fake_endpoint}",
160
+ Tags=[{"Key": "PermissionCheck", "Value": "Test"}],
161
+ )
162
+
163
+ # If we get here, we have permission (but endpoint doesn't exist)
164
+ return True
165
+
166
+ except ClientError as e:
167
+ error_code = e.response["Error"]["Code"]
168
+
169
+ # AccessDeniedException = no permission
170
+ if error_code == "AccessDeniedException":
171
+ self.log.debug("No AddTags permission (AccessDeniedException)")
172
+ return False
173
+
174
+ # ResourceNotFound = we have permission, but endpoint doesn't exist
175
+ elif error_code in ["ResourceNotFound", "ValidationException"]:
176
+ self.log.debug("AddTags permission verified (resource not found)")
177
+ return True
178
+
179
+ # Unexpected error, assume no permission for safety
180
+ else:
181
+ self.log.debug(f"Unexpected error checking permissions: {error_code}")
182
+ return False
183
+
144
184
 
145
185
  if __name__ == "__main__":
146
186
  """Exercise the AWS Account Clamp Class"""
@@ -165,3 +205,9 @@ if __name__ == "__main__":
165
205
  print("\n\n*** AWS Sagemaker Session/Client Check ***")
166
206
  sm_client = aws_account_clamp.sagemaker_client()
167
207
  print(sm_client.list_feature_groups()["FeatureGroupSummaries"])
208
+
209
+ print("\n\n*** AWS Tag Permission Check ***")
210
+ if aws_account_clamp.check_tag_permissions():
211
+ print("Tag Permission Check Success...")
212
+ else:
213
+ print("Tag Permission Check Failed...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workbench
3
- Version: 0.8.175
3
+ Version: 0.8.176
4
4
  Summary: Workbench: A Dashboard and Python API for creating and deploying AWS SageMaker Model Pipelines
5
5
  Author-email: SuperCowPowers LLC <support@supercowpowers.com>
6
6
  License-Expression: MIT
@@ -48,7 +48,7 @@ workbench/cached/cached_model.py,sha256=iMc_fySUE5qau3feduVXMNb24JY0sBjt1g6WeLLc
48
48
  workbench/cached/cached_pipeline.py,sha256=QOVnEKu5RbIdlNpJUi-0Ebh0_-C68RigSPwKh4dvZTM,1948
49
49
  workbench/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  workbench/core/artifacts/__init__.py,sha256=ps7rA_rbWnDbvWbg4kvu--IKMY8WmbPRyv4Si0xub1Q,965
51
- workbench/core/artifacts/artifact.py,sha256=AtTw8wfMd-fi7cHJHsBAXHUk53kRW_6lyBwwsIbHw54,17750
51
+ workbench/core/artifacts/artifact.py,sha256=WFGC1F61d7uFSRB7UTWYOF8O_wk8F9rn__THJL2veLM,17752
52
52
  workbench/core/artifacts/athena_source.py,sha256=RNmCe7s6uH4gVHpcdJcL84aSbF5Q1ahJBLLGwHYRXEU,26081
53
53
  workbench/core/artifacts/cached_artifact_mixin.py,sha256=ngqFLZ4cQx_TFouXZgXZQsv_7W6XCvxVGXXSfzzaft8,3775
54
54
  workbench/core/artifacts/data_capture_core.py,sha256=q8f79rRTYiZ7T4IQRWXl8ZvPpcvZyNxYERwvo8o0OQc,14858
@@ -60,7 +60,7 @@ workbench/core/artifacts/model_core.py,sha256=6d5dV4DGUBgD9E_Gpk0F5x7OEc4oiDKokv
60
60
  workbench/core/artifacts/monitor_core.py,sha256=M307yz7tEzOEHgv-LmtVy9jKjSbM98fHW3ckmNYrwlU,27897
61
61
  workbench/core/cloud_platform/cloud_meta.py,sha256=-g4-LTC3D0PXb3VfaXdLR1ERijKuHdffeMK_zhD-koQ,8809
62
62
  workbench/core/cloud_platform/aws/README.md,sha256=QT5IQXoUHbIA0qQ2wO6_2P2lYjYQFVYuezc22mWY4i8,97
63
- workbench/core/cloud_platform/aws/aws_account_clamp.py,sha256=vAVC_HEk1YGSlo5F2bhQlWUxPN2QgRe3ht73O42faWQ,6452
63
+ workbench/core/cloud_platform/aws/aws_account_clamp.py,sha256=V5iVsoGvSRilARtTdExnt27QptzAcJaW0s3nm2B8-ow,8286
64
64
  workbench/core/cloud_platform/aws/aws_df_store.py,sha256=utRIlTCPwFneHHZ8_Z3Hw3rOJSeryiFA4wBtucxULRQ,15055
65
65
  workbench/core/cloud_platform/aws/aws_graph_store.py,sha256=ytYxQTplUmeWbsPmxyZbf6mO9qyTl60ewlJG8MyfyEY,9414
66
66
  workbench/core/cloud_platform/aws/aws_meta.py,sha256=eY9Pn6pl2yAyseACFb2nitR-0vLwG4i8CSEXe8Iaswc,34778
@@ -288,9 +288,9 @@ workbench/web_interface/page_views/main_page.py,sha256=X4-KyGTKLAdxR-Zk2niuLJB2Y
288
288
  workbench/web_interface/page_views/models_page_view.py,sha256=M0bdC7bAzLyIaE2jviY12FF4abdMFZmg6sFuOY_LaGI,2650
289
289
  workbench/web_interface/page_views/page_view.py,sha256=Gh6YnpOGlUejx-bHZAf5pzqoQ1H1R0OSwOpGhOBO06w,455
290
290
  workbench/web_interface/page_views/pipelines_page_view.py,sha256=v2pxrIbsHBcYiblfius3JK766NZ7ciD2yPx0t3E5IJo,2656
291
- workbench-0.8.175.dist-info/licenses/LICENSE,sha256=z4QMMPlLJkZjU8VOKqJkZiQZCEZ--saIU2Z8-p3aVc0,1080
292
- workbench-0.8.175.dist-info/METADATA,sha256=hAjhM-oXEqxffYyDwawIsSdTv3iKsRs5_OiZw1sv2RQ,9210
293
- workbench-0.8.175.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
294
- workbench-0.8.175.dist-info/entry_points.txt,sha256=zPFPruY9uayk8-wsKrhfnIyIB6jvZOW_ibyllEIsLWo,356
295
- workbench-0.8.175.dist-info/top_level.txt,sha256=Dhy72zTxaA_o_yRkPZx5zw-fwumnjGaeGf0hBN3jc_w,10
296
- workbench-0.8.175.dist-info/RECORD,,
291
+ workbench-0.8.176.dist-info/licenses/LICENSE,sha256=z4QMMPlLJkZjU8VOKqJkZiQZCEZ--saIU2Z8-p3aVc0,1080
292
+ workbench-0.8.176.dist-info/METADATA,sha256=4uDF0MKfrLJrqmAiwYsUlCOA8o5BlxNTLweZLFwtYS0,9210
293
+ workbench-0.8.176.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
294
+ workbench-0.8.176.dist-info/entry_points.txt,sha256=zPFPruY9uayk8-wsKrhfnIyIB6jvZOW_ibyllEIsLWo,356
295
+ workbench-0.8.176.dist-info/top_level.txt,sha256=Dhy72zTxaA_o_yRkPZx5zw-fwumnjGaeGf0hBN3jc_w,10
296
+ workbench-0.8.176.dist-info/RECORD,,